JSON → TOML
Convert a JSON object to TOML.
Private by design. Your input never leaves this browser. Conversions run locally on your device.
What this tool handles
- A JSON array at the document root is wrapped in a table named items, and the wrapping is reported.
- Null values are dropped and every dropped path is reported.
- Nested objects become TOML tables and arrays of objects become [[array]] blocks.
Example
JSON
{"title":"FormatPort","owner":{"name":"Ada"},"ports":[80,443]}
TOML
title = "FormatPort"
ports = [ 80, 443 ]
[owner]
name = "Ada"
When you would use it
- Writing a Cargo or pyproject section — A dependency map you already hold as JSON becomes a [dependencies] table, and a nested object such as tool.ruff becomes the [tool.ruff] header that file expects.
- Repeated blocks in a wrangler.toml — An array of objects is emitted as one [[name]] block per element, which is the shape [[kv_namespaces]] or [[redirects]] entries take when a script generates them rather than a person typing them.
- Moving a project off a JSON config file — Tools that have switched from a .json config to a .toml one need the same settings in the new syntax. Convert once and commit the result, rather than retyping every key by hand.
Common questions
What happens to an array at the document root?
TOML requires a table there, so the records are wrapped in a table named items and the wrapper is reported as a warning. A root value that is a string, number or null is refused outright, because there is nothing sensible to wrap.
Can a TOML array hold mixed types?
Yes, and one is written out unchanged: [1, "a", true] survives the conversion. Mixed-type arrays became legal in TOML 1.0, so a parser pinned to an older revision may still reject what comes out.
Why is my timestamp a quoted string rather than a date?
JSON has no date type, so "2024-05-01T00:00:00Z" arrives as text and leaves as text in quotes, not as a TOML offset date-time. Retype the value without quotes afterwards if the reader expects a real date.
Why did the key order change?
Everything written after a [table] header belongs to that table, so plain key-value pairs are emitted first and every table and array of tables after them. Order within each table follows the JSON.
Related tools
- TOML → JSON — Parse TOML configuration into JSON.
- Convert any format — Pick an input format and an output format and convert between any pair.
- JSON → YAML — Convert JSON to readable YAML with configurable indentation.
- YAML → JSON — Parse YAML and emit pretty-printed JSON.
- JSON → CSV — Turn an array of objects into a CSV table.
- CSV → JSON — Parse CSV or TSV into JSON, with delimiter detection and optional type coercion.