Qu

parse_json

Builtin index · File I/O

result = parse_json(str)

Input: str · Output: result

What it is

jsonify's inverse. str (string) is JSON text — either a jsonify/save-style {"type": ...} envelope, or ordinary JSON from anywhere else (e.g. an HTTP API response), which is mapped in generically.

Overloads

str can be string or Complex.

2 forms. Each carries its own inputs, outputs and worked example — pick the tab for the one you are calling.

CodeInputOutputDescription
result = parse_json(str)
str stringnot documented yet
result —
Returns the exact typed Value that tag names, reconstructed in full, not a generic guess from the JSON's own shape.

Examples

Written for this form and run by the build -- the output below is what the engine actually produced.

env = jsonify(3 + 4j)
back = parse_json(env)
print(env)          # {"type":"complex","re":3.0,"im":4.0}

print(type(back))   # complex

print(back)         # 3 + 4j

output
{"type":"complex","re":3.0,"im":4.0}
complex
3 + 4j
CodeInputOutputDescription
result = parse_json(str)
str Complexnot documented yet
result —
Mapped in generically instead: a bare object becomes a record field-for-field, so the identical re/im pair that named a Complex above comes back as a plain record once the tag naming it is gone.

Examples

Written for this form and run by the build -- the output below is what the engine actually produced.

env = jsonify(3 + 4j)
plain = replace(env, "\"type\":\"complex\",", "")
v = parse_json(plain)
print(plain)         # {"re":3.0,"im":4.0}

print(type(v))       # record

output
{"re":3.0,"im":4.0}
record