TOML to JSON
Parse and convert TOML to JSON.
About TOML to JSON
Parses a TOML document and outputs it as indented JSON, so you can inspect a Cargo.toml, pyproject.toml or other TOML configuration, or hand it to a program that only reads JSON.
When you would use it
- Reading a TOML file in a script or a jq pipeline that expects JSON.
- Checking how TOML tables, dotted keys and arrays of tables map to nested objects.
- Validating a TOML file: syntax errors are reported as you type.
How to use it
- Paste the TOML into the left field.
- Read the JSON on the right, indented with three spaces.
- Copy the result.
Things worth knowing
- TOML dates and times (for example 1979-05-27T07:32:00Z) become ISO 8601 strings in JSON, since JSON has no date type.
- Integers beyond JavaScript's safe range (about 9 quadrillion) are not supported and leave the output empty.
- Comments are dropped, and the output is always a JSON object because a TOML document is always a table.
- Duplicate keys and tables defined twice are errors in TOML, so the converter rejects them rather than silently keeping one.
Frequently asked questions
- Why do my dates come out as strings?
- TOML has native date-time values but JSON does not, so they are serialised as ISO 8601 text. Parse them back into dates in the consuming program if needed.
- Can I convert JSON back to TOML?
- Yes, with the JSON to TOML tool, as long as the JSON has an object at the top level; null values are dropped on the way.