"category": "format-converter",
TOML to JSON Converter
"tldr": Paste TOML - Cargo.toml, pyproject.toml, any config - and get pretty-printed JSON with types preserved.
Convert any TOML document - a Cargo.toml, pyproject.toml, or application config - into pretty-printed JSON. Tables become objects, arrays of tables become arrays of objects, and TOML dates, integers, and floats map to their closest JSON representations.
The usual reason to do this: tooling. jq, JSON Schema validators, and most APIs speak JSON, not TOML. Converting lets you query a Cargo.toml with jq or validate a pyproject.toml against a schema without writing a parser.
How to convert TOML to JSON
- 1Paste your TOML - full TOML 1.0 is supported, including dotted keys and arrays of tables.
- 2Syntax errors are reported with the line where parsing failed.
- 3[[array.of.tables]] sections become JSON arrays of objects.
- 4Copy the pretty-printed JSON output.
Convert TOML to JSON in code
import json, tomllib
with open("pyproject.toml", "rb") as f:
data = tomllib.load(f)
print(json.dumps(data, indent=2, default=str))# convert here, then:
jq '.dependencies | keys' cargo.jsonFrequently asked questions
What happens to TOML dates and times?
TOML has first-class datetime types; JSON does not. They convert to ISO 8601 strings - the standard JSON convention - so 2026-07-30T12:00:00Z becomes the string "2026-07-30T12:00:00.000Z".
What does [[double brackets]] mean in my TOML?
An array of tables: each [[workers]] section appends one object to the workers array. In JSON it becomes "workers": [{...}, {...}] - which is often the "aha" of seeing your TOML as JSON.
Are comments preserved?
No - JSON has no comments, so # lines are dropped. If you need to round-trip a commented config, keep TOML as the source of truth and generate JSON only for tooling.
Last updated:
You might also need
Free and in-browser, like everything on JSON Console. Browse all tools →