Data

JSON TOML Converter

Convert JSON and TOML both ways using a practical subset parser.

Loading interactive tool…

Embed this tool on your site

About this tool

TOML is the config format behind Cargo.toml in Rust, pyproject.toml in Python, and Hugo and Zola site configs. This converter translates between TOML and JSON for the parts of TOML that everyday configs use, without you having to remember the syntax for tables and arrays of tables. Its parser is a deliberate subset: key = value pairs, dotted keys, [table] and [[array of tables]] headers, inline tables, single-line arrays, quoted strings, integers and floats (with _ separators), booleans and # comments. Datetimes are kept as the exact text you wrote, as a JSON string. Multi-line strings and arrays, hex, octal and binary numbers, inf and nan, and quoted keys that contain dots are not supported. In the JSON → TOML direction, plain values come first, nested objects become [section] tables and arrays of objects become [[section]] blocks. TOML has no null, yet a JSON null is written as key = null, which TOML parsers reject, so remove nulls first. Comments are dropped on the way to JSON, and conversion runs in your browser.

Why use it

  • Tables and Arrays of Tables: [package]-style tables and [[bin]]-style arrays of tables convert to nested JSON objects and arrays, and back again, so Cargo-style manifests keep their shape.

  • Inline Tables and Dotted Keys: Inline tables like serde = { version = "1.0", features = ["derive"] } and dotted keys like a.b = 1 become nested JSON objects.

  • Clean TOML Output: JSON → TOML writes plain values first, then each nested object as a [section] block and each array of objects as [[section]] blocks, separated by blank lines.

  • Honest Subset Parser: Anything outside the supported subset stops with an 'Unsupported TOML value' error instead of being converted silently.

  • Local Parse, Zero Telemetry: API tokens, release-signing keys, and credentials stored in TOML config files stay in your browser tab during the entire conversion process. Nothing is uploaded, transmitted, logged, or forwarded to any remote server at any point.

How to use

  1. Click JSON → TOML or TOML → JSON to choose the direction
  2. Paste the source config content into the input box
  3. Click Convert, or press Ctrl/Cmd+Enter in the input
  4. Read any error message, such as 'Line 4: expected key = value' or 'Unsupported TOML value'
  5. Use Swap to move the output back into the input and flip direction, then Copy the result

When it helps

  • Inspecting a Cargo.toml file as JSON to programmatically extract dependency versions or feature flags
  • Turning a JSON config object into a starting pyproject.toml or Hugo config.toml
  • Adjusting a simple TOML config by converting to JSON, editing programmatically, then converting back
  • Validating the structure of a TOML config by examining its JSON equivalent in a JSON schema validator
  • Converting TOML fixtures into JSON for use in a test suite that expects JSON input

Examples

Cargo.toml → JSON

Input
[package]
name = "my_crate"
version = "0.1.0"
edition = "2021"

[dependencies]
serde = { version = "1.0", features = ["derive"] }
tokio = "1.35"
Expected result · Scroll for more
{
  "package": {
    "name": "my_crate",
    "version": "0.1.0",
    "edition": "2021"
  },
  "dependencies": {
    "serde": {
      "version": "1.0",
      "features": [
        "derive"
      ]
    },
    "tokio": "1.35"
  }
}

JSON → TOML with array of tables

Input
{
  "servers": [
    {"name": "alpha", "ip": "10.0.0.1"},
    {"name": "beta", "ip": "10.0.0.2"}
  ]
}
Expected result
[[servers]]
name = "alpha"
ip = "10.0.0.1"

[[servers]]
name = "beta"
ip = "10.0.0.2"

Datetime kept as text

Input
release_date = 2025-05-07T14:30:00Z
build_id = 42
Expected result
{
  "release_date": "2025-05-07T14:30:00Z",
  "build_id": 42
}

Tips

  • TOML has no null type — delete null fields from your JSON before converting, because key = null is not valid TOML.
  • Cargo.toml expects the [package] section near the top; when converting back from JSON, verify section ordering looks reasonable or rustc may emit warnings.
  • Join multi-line arrays and strings onto one line before converting TOML to JSON; the parser reads one line at a time.
  • TOML datetimes become plain JSON strings; if you convert back, add the unquoted datetime by hand where your reader expects a typed date.
  • Adding blank lines between [section] blocks in TOML output improves readability significantly — TOML ignores them but humans appreciate the visual separation.

Frequently Asked Questions

What's the difference between an inline table and a standard table in TOML?
An inline table is written on one line: {key = "val", other = 1}. A standard table uses a [section] header followed by key-value pairs on separate lines. Both are read as nested objects; on output, this tool writes nested objects as standard [section] tables.
Will my TOML comments be preserved when converting to JSON?
No. JSON has no comment syntax, so # comments are discarded when converting to JSON, without a warning. Keep the original TOML in version control if comments matter.
How are TOML datetimes represented in JSON?
As a JSON string containing exactly what you wrote, such as "2025-05-07T14:30:00Z". In the JSON → TOML direction, every string — including one that looks like a date — is written as a quoted TOML string, not a typed datetime.
Can I convert a Cargo.toml file?
Typical Cargo.toml files convert: [package], [dependencies] with inline tables, [features] and [[bin]] or [[example]] blocks are supported. Multi-line arrays, which some manifests use for long feature lists, are not; put them on one line first.
Does it support dotted keys?
Yes. Dotted keys like a.b.c = "val" become {"a": {"b": {"c": "val"}}} in JSON. Quoted keys that contain a dot, such as "site.com" = 1, are split at the dot, so avoid them.
What happens to JSON nulls — does TOML support them?
TOML has no null type, but this tool writes a JSON null as key = null, which real TOML parsers reject. Remove null values or replace them with a placeholder before converting.
How are arrays of tables ([[bin]]) translated?
A JSON array of objects at a key named bin converts to TOML's [[bin]] array-of-tables notation, with each object becoming its own [[bin]] block. Going the other way, each [[bin]] block becomes one object in a JSON array.
Is my config file uploaded to a server?
No. The entire conversion runs in your browser using a JavaScript TOML parser and serialiser. No network request is made and no data leaves your tab. API tokens, secrets, and credentials in your config stay completely local.

Explore the category

Glossary

TOML 1.0
The current stable version of Tom's Obvious Minimal Language, a configuration file format designed to be unambiguous and easy to parse. Used by Cargo (Rust), pyproject.toml (Python), and Hugo as the primary config format.
Array of tables ([[...]])
A TOML syntax using double square brackets [[sectionName]] to define an array of objects with the same key. Each [[sectionName]] block becomes one element in the array, used in Cargo.toml for [[bin]], [[example]], and [[test]] targets.
Inline table
A compact TOML table written on a single line using curly braces: {key = "value", other = 42}. Semantically identical to an expanded [section] table but limited to one line by the TOML 1.0 spec.
Bare key
A TOML key that does not require quoting — containing only ASCII letters, digits, dashes, and underscores. Keys with spaces or special characters must be quoted in double or single quotes.
RFC 3339 datetime
A standardised format for representing dates and times as strings, such as 2025-05-07T14:30:00Z. TOML treats RFC 3339 datetimes as a first-class type, distinct from plain strings, and preserves timezone information.
pyproject.toml
The standardised Python project configuration file defined in PEP 517 and PEP 621, written in TOML. It replaces setup.py and setup.cfg for packaging metadata, build system configuration, and tool settings.
A LITTLE HELP. A LOT DONE.
Good tools.
Great flow.

Your shortcut to the everyday. Create, convert, calculate,
and get back to what you love.

✓ Free to use✓ No sign-up✓ 500+ possibilities