Qu

jsonify

Builtin index · File I/O

result = jsonify(value)

Input: value · Output: result

What it is

Converts any value (any Value — number, string, Vec, Table, Record, ...) to a JSON string — exactly the save/load on-disk shape (see the link above: a {"type": ..., ...} envelope), just returned as a string instead of written to a file.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = jsonify(value)
value number, string, Vec, Table, or Recordnot documented yet
result string
Returns a string.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

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

from file-io

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

from file-io

t = parse_csv("product,price\nWidget,9.99\nGadget,4.50\n")

csv_text = csvify(t)
json_text = jsonify(t)

back_from_json = json2csv(json_text)   # csvify(parse_json(json_text))

print(back_from_json)

xml_from_csv = csv2xml(csv_text)       # xmlify(parse_csv(csv_text))

csv_from_xml = xml2csv(xml_from_csv)   # csvify(parse_xml(xml_from_csv))

print(csv_from_xml)

xml_from_json = json2xml(json_text)    # xmlify(parse_json(json_text))

json_from_xml = xml2json(xml_from_json) # the row-object array, not jsonify(parse_xml(...))

parsed = parse_json(json_from_xml)      # parse_json accepts that shape too -- back to a real Table

print(nrow(parsed))                     # 2

output
product,price
Widget,9.99
Gadget,4.5

product,price
Widget,9.99
Gadget,4.5

2

from file-io

How it works

§ data-format conversion builtins (2026-09-01, Ahmed's ask — see BACKLOG.md's "Format conversion builtins" entry). Three formats (JSON/CSV/XML), each with a xify(value) -> str / parse_x(str) -> value primitive pair, plus six pairwise converters that are ONE-LINE compositions of those primitives — not six independent implementations. jsonify/parse_json expose value_to_json/json_to_value (just above/below this very arm — save/save_all/load's own machinery, never previously reachable as a plain string round trip) through serde_json::to_string/from_str; csvify/parse_csv string-based internally (read_csv/write_csv above are themselves thin file-I/O wrappers around exactly these two); mapping (see that module's own doc comment for the full design — the one genuinely new piece here, everything else is "expose what already exists").

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.