Convert JSON documents into TOML with configurable indentation and pretty-print toggles.
Convert JSON documents into TOML with configurable indentation and pretty-print toggles. Convert JSON documents into TOML with configurable indentation and pretty-print toggles.
Output
Background
Why convert JSON to TOML
JSON is everywhere on the wire, but TOML is the format most modern
config files actually use (Cargo, pyproject.toml, GitHub Actions,
uv, and many more). When you copy a JSON snippet from an API into
a config file, you usually have to translate the syntax by hand:
braces become sections, brackets become arrays, commas become
newlines, and quoted keys become bare keys.
A converter automates that translation so you can paste the API
response, copy the TOML output, and be done.
Features worth knowing
Most converters preserve the JSON object order by default. TOML
allows you to reorder sections, so a "sort keys" option helps when
you want a stable diff between runs. Indentation control lets you
match the style guide of the project (two or four spaces).
For arrays of tables in TOML, the converter emits the inline form
key = [ ... ] when the JSON array contains a single uniform
object, and a header form [[section]] for lists that mix types
or repeat the same schema. This is the only case where the
conversion is not fully mechanical.
Workflow tips
Before committing the TOML, double-check that the keys you used
in JSON are legal TOML bare keys (no spaces, no leading digits,
no dashes at the start). The converter keeps the names verbatim;
it does not rename them. After conversion, paste into your editor
and run your project's linter to catch any style issues the
converter is unaware of.
Practical example
Imagine you have an API response that lists your project's feature flags and you want to paste them straight into a pyproject.toml block. The JSON looks like { "name": "beetools", "features": ["json", "toml"] }. After conversion the TOML reads name = "beetools" and features = ["json", "toml"], and you can drop it into [tool.beetools] without further massaging. Arrays of tables ([[items]]) come from JSON arrays whose elements are objects with identical keys; the converter detects the homogeneous shape and emits the multi-line form automatically. If you see a flattened output instead, the input mixed types -- split the source manually and re-run.
Frequently asked questions
Does the converter support nested objects?
Yes. Nested JSON objects become nested TOML tables. The converter preserves depth, and very deep nesting expands into `[[section.sub]]` headers accordingly.
What about arrays of primitives?
Arrays of primitives (numbers, strings, booleans) become TOML inline arrays. Arrays of mixed types are rejected by the underlying parser because TOML requires arrays to be homogeneous.
Are JSON null values preserved?
TOML has no null literal. The converter drops `null` values and emits a warning; if you need to record absence, switch to an empty string or a sentinel value before conversion.
Why is the output missing comments from the original JSON?
JSON does not support comments. If you need comments in the TOML, add them by hand after conversion.
Will the converter change the order of keys?
No. By default keys are emitted in JSON order. Enable the sort option if you want a stable, alphabetical layout for diffing.
Is my JSON sent anywhere?
No. Conversion happens entirely in your browser using native JSON.parse and the bundled smol-toml library.