JSON and data guides
TOML to JSON: tables, dotted keys and type boundaries
Map TOML tables and arrays of tables to JSON while checking date, integer and comment fidelity.
Map a table to an object
A table header establishes an object path. A dotted key expresses nested structure rather than a literal property containing dots.
Convert this minimal fixture first and inspect the nesting in JSON Formatter. Quoted TOML keys can instead contain literal dots.
[server]
port = 8080
limits.requests = 10
→ {"server":{"port":8080,"limits":{"requests":10}}}Use arrays of tables deliberately
Double-bracket headers append a table to an array. Two entries remain two ordered objects in JSON.
Do not replace this with duplicate ordinary table headers; TOML forbids defining the same table twice in ways the specification disallows.
[[jobs]]
name = "first"
[[jobs]]
name = "second"Identify types JSON cannot preserve
TOML has date/time types that JSON lacks. Conversion may serialize a parser date object into text, changing how a reverse conversion sees it.
TOML also permits integer ranges beyond JavaScript safe integers. Use conservative fixtures and inspect the actual output of the installed parser.
Treat the round trip as data conversion
Comments, whitespace and original table layout are not represented in the JSON value. A round trip is not a source-preserving edit.
For configuration maintenance, keep the original TOML and review a text diff after changes. Use JSON output for inspecting values and paths.