Free JSON to TOML Converter

Convert JSON data to TOML configuration format in your browser. Free, fast, and works entirely in your browser with no sign-up required.

Updated

Share:
Home/Converter Tools/JSON to TOML Converter

JSON to TOML Converter

Convert JSON to TOML instantly in your browser. Supports tables, arrays-of-tables, inline arrays, and all TOML data types. Zero upload, everything runs client-side.

955 B in
38 lines out
761 B out
Valid

Conversion Options

JSON Input

TOML Output

About JSON to TOML conversion

TOML (Tom's Obvious Minimal Language) is a configuration file format designed to be easy to read and write. It is widely used in Rust (Cargo.toml), Python (pyproject.toml), Hugo, Deno, and many other ecosystems. TOML supports rich data types including strings, integers, floats, booleans, dates, arrays, and nested tables.

This converter runs entirely in your browser with a from-scratch serializer -- no external libraries are used. It maps JSON objects to TOML tables, arrays of objects to [[array-of-tables]], and primitive arrays to inline arrays. Strings are properly quoted and escaped, and dates in ISO 8601 format are preserved.

Frequently Asked Questions

What is TOML?

TOML is a minimal configuration language designed to be easy to read and write.

Are nested objects supported?

Yes — nested JSON objects are converted to TOML sections and arrays of objects become TOML array tables.

Is it free?

Yes, completely free. All processing happens in your browser.

Is my data safe with this tool?

Absolutely. The JSON to TOML Converter processes everything client-side in your browser. No data is uploaded to or stored on any server. Your content remains private on your device at all times.

Does the JSON to TOML Converter work on mobile devices?

Yes, the JSON to TOML Converter is fully responsive and works on smartphones and tablets. You can use it on any device with a modern web browser -- no app download required.

Do I need to create an account to use this tool?

No account or registration is needed. Simply open the JSON to TOML Converter in your browser and start using it immediately. There are no sign-up walls or usage restrictions.

How do I use the JSON to TOML Converter?

Simply enter your input in the provided field, adjust any settings to your preference, and the tool will process it instantly. You can then copy the result to your clipboard or download it.

Which browsers are supported?

The JSON to TOML Converter works in all modern browsers including Chrome, Firefox, Safari, Edge, and Opera. For the best experience, use the latest version of your preferred browser.

What is the difference between JSON and TOML?

JSON and TOML both store structured key-value data, but they serve different purposes. JSON is a data-interchange format built for machines: it uses braces, quoted keys, and no comments, which makes it compact but harder to read and edit by hand. TOML (Tom's Obvious Minimal Language) is built for configuration files humans maintain. It allows comments, uses bare unquoted keys, and groups related settings under readable [table] headers, which is why Rust's Cargo.toml, Python's pyproject.toml, Hugo, and Deno all adopted it. TOML also has no null type and adds native dates, whereas JSON keeps everything as strings, numbers, booleans, arrays, objects, or null. This converter handles the structural translation between the two, mapping objects to tables and arrays of records to array-of-tables. Paste your JSON above to see clean TOML appear instantly.

How does JSON null convert to TOML?

TOML has no null type at all, so a JSON null cannot be represented directly the way it can in JSON or YAML. Rather than dropping the key silently, which would quietly change your data's shape, this converter writes a JSON null as an empty string (key = ""). That keeps the key present in the output so you can see it and decide what the value should actually be. This matters because a missing key and an explicit empty value mean different things to most config parsers. After converting, scan any keys you expect to hold real values and replace the empty strings with a proper default, a real value, or delete the line if the setting is genuinely optional. Paste your JSON above and the tool flags every null as an empty string for you to review.

How are arrays of objects converted to TOML array-of-tables?

When a JSON array contains objects rather than plain values, this converter emits it as a TOML array-of-tables, the idiomatic pattern for a list of records. Each element becomes its own repeated [[name]] block, with the object's fields written as key = value lines underneath. So a JSON array of two binary definitions produces two separate [[bin]] headers, each followed by its own name and path. This is different from a single nested object, which becomes one [table] header instead. Arrays that hold only strings, numbers, or booleans are left as ordinary inline arrays rather than being expanded into tables. The distinction is automatic and based on the contents of each array, so you do not need to flag anything. Paste a JSON config with a list of records above and watch the matching [[array-of-tables]] blocks build as you type.

Why does the top-level JSON need to be an object?

A valid TOML document is fundamentally a set of key-value pairs at its root, so it must begin with named keys, not an anonymous value. A JSON object maps cleanly onto that structure, but a bare array like [1, 2, 3] or a lone primitive at the very top has no key to attach it to, which means there is no correct way to write it as standalone TOML. For that reason the converter requires the outermost JSON value to be an object and reports an error if you paste an array or primitive at the root. The fix is simple: wrap your data under a key, for example {"items": [1, 2, 3]}, and it converts cleanly into a named array. The live status badge shows Valid or Error as you type, so paste your JSON above and adjust the root if needed.

Should I use inline or one-per-line arrays in TOML?

Both layouts are valid TOML and parse identically; the choice is about readability and version control. Inline keeps a primitive array on a single line, like ports = [80, 443], which is compact and ideal for short lists. One per line expands each element onto its own row inside the brackets, which reads far better for long arrays and produces cleaner diffs, since adding or removing one item changes a single line instead of rewriting the whole row. A good rule of thumb is inline for two or three short values and one-per-line for longer lists you expect to edit over time. This converter exposes both as a toggle, and you can also sort keys alphabetically for consistent, diff-friendly output. Pick the layout that matches your project's house style above, and the TOML regenerates instantly.

About the JSON to TOML Converter

The JSON to TOML Converter turns a JSON object into clean, valid TOML configuration as you type. Paste your JSON on the left, and the equivalent TOML appears instantly on the right — with nested objects mapped to tables, arrays of objects mapped to array-of-tables, and primitive arrays kept as arrays. It is built for developers who maintain config files: anyone moving an API response, a settings export, or a hand-written JSON blob into the format that Rust's Cargo.toml, Python's pyproject.toml, Hugo, or Deno expect.

TOML — Tom's Obvious Minimal Language — is a configuration format designed to be unambiguous and easy to read. Unlike JSON it allows comments, uses bare unquoted keys, and groups related settings under [table] headers, which is why it has become the default for so many modern toolchains. This converter does the structural translation for you.

How the conversion works

Conversion is live: every keystroke re-parses the JSON and regenerates the TOML, and a status badge shows Valid or Error in real time. When the JSON is malformed, the tool reports the parser message and an approximate line number so you can find the problem quickly. One rule to know up front: the top-level value must be a JSON object. A bare array or a primitive at the root cannot become a TOML document, since TOML files are always a set of key-value pairs.

The serializer is written from scratch and uses no external libraries, and it maps JSON to TOML like this:

  • Objects become tables — a nested object is emitted under a [parent.child] header using dotted paths.
  • Arrays of objects become array-of-tables — each element is written as a repeated [[name]] block, the idiomatic TOML pattern for lists of records.
  • Primitive arrays stay as arrays — strings, numbers, and booleans render as a single [...] list.
  • Keys are quoted only when needed — a key made only of letters, digits, underscores, or hyphens is left bare; anything else is wrapped in quotes and escaped.

Data types and edge cases

TOML has no null, so a JSON null is written as an empty string ("") rather than dropped silently. Booleans become true / false, and numbers are preserved as written. Special floating-point values are handled too: Infinity maps to inf, -Infinity to -inf, and NaN to nan, matching the TOML spec. Strings are escaped properly — backslashes, quotes, tabs, and newlines are converted to their TOML escape sequences — and date-like strings in ISO 8601 form are kept intact.

Output options

Two settings let you match your project's house style:

  • Primitive array layout — choose Inline to keep arrays on one line (ports = [80, 443]), or One per line to expand each element onto its own row, which reads better for long lists in version control.
  • Sort keys — leave it on Preserve order to keep the original JSON key order, or switch to Alphabetical to sort keys for consistent, diff-friendly output.

A live readout shows input size in bytes, the number of output lines, and output size. When you are happy with the result, copy the TOML to your clipboard or download it as a converted.toml file. Buttons to paste from the clipboard, load a sample Cargo.toml-style document, and clear the editor are all one click away.

Privacy and offline use

Everything happens in your browser. The JSON you paste is parsed and converted on your own device — nothing is uploaded to a server, and there is no sign-up, account, or usage limit. That makes the JSON to TOML Converter safe for internal configs, secrets-adjacent settings, and unreleased project files, and it keeps working offline once the page has loaded. Paste your JSON above to see the TOML build itself as you type.