Account

What new tool do you want?

Developer Tools

TOML / INI / ENV ↔ JSON Converter

Convert config files between TOML, INI, .env and JSON — validate a TOML file or turn a .env into JSON in one step.

How to use

  1. 1Choose the input and output formats.
  2. 2Paste your config and copy the converted result.

Frequently asked questions

Which TOML version is supported?

TOML 1.0, including tables, arrays of tables, inline tables, dates and multi-line strings.

How are nested JSON objects written to .env?

Keys are joined with underscores and uppercased, so { "db": { "host": "x" } } becomes DB_HOST=x.

Are values in .env files typed?

No. Environment variables are always strings, so values stay as text when converting from .env.

Four formats, one JSON hub — and each has its own quirks going in

TOML parsing (via smol-toml) covers the full TOML 1.0 spec — tables, arrays of tables, inline tables, native dates and multi-line strings — so a real `pyproject.toml` or `Cargo.toml` round-trips correctly. INI and .env, by contrast, have no formal standard, so this tool implements pragmatic parsers for them: INI sections become nested objects, values get type-inferred (so `port = 5432` becomes a number, not the string '5432'), and quoted values have their surrounding quotes stripped. The .env parser handles the conventions real dotenv files use in practice — `export KEY=value` prefixes, `#` trailing comments outside quotes, and both single- and double-quoted values with different escaping rules (double-quoted values process `\n` and `\"` escapes, single-quoted values are taken completely literally).

Going to .env is lossy in a way that matters

Environment variables are flat, uppercase strings by nature, so converting a nested JSON object to .env joins keys with underscores and uppercases them (`{ "db": { "host": "x" } }` → `DB_HOST=x`) — which is one-way: you can't tell from `DB_HOST` alone whether the original JSON had an underscore in a single key or a nested object boundary. Arrays become comma-joined strings, which loses the distinction between an array of one comma-containing string and an array of two plain strings. If you need the reverse conversion to reconstruct exact structure, keep the original JSON around rather than relying on round-tripping through .env.

Why this doubles as a TOML validator

Because TOML parsing runs through a real parser rather than regex, pasting a TOML file and converting it to JSON (or anything else) will surface a real syntax error — with the offending line in the message — if the TOML is malformed, which makes 'convert TOML to JSON' a reasonable substitute for a dedicated TOML linter when you just need a quick syntax check on a config file.

Worked example: TOML / INI / ENV ↔ JSON Converter

TOML input `title = "App"\n[db]\nport = 5432` converts to JSON as `{ "title": "App", "db": { "port": 5432 } }` — the `[db]` table header becomes a nested object. Converting a .env file `# c\nexport API_KEY="a b"\nDEBUG=true # on` to JSON gives `{ "API_KEY": "a b", "DEBUG": "true" }` — note DEBUG stays the string `"true"`, not a boolean, since .env values are always text. Going from JSON `{"db":{"host":"x","port":1},"name":"a b"}` to .env produces `DB_HOST=x`, `DB_PORT=1`, and `NAME="a b"` (quoted because it contains a space).

YAML is only on the way out

From opens on TOML and To opens on JSON. YAML is on the To menu and not on the From menu, so I cannot paste YAML into this box and convert it. I would use the YAML converter for that direction. Invalid TOML stops with the words Invalid TOML and only the first line of the reason. Invalid JSON uses a line and a column. INI and .env are the other inputs, and TOML, INI, .env, and YAML are the other outputs beside JSON. Picking the same format on both sides still runs the text through that format's read and write, which is a way to see whether the text was accepted.

Related tools

More: Developer Tools