UtilityKit

500+ fast, free tools. Most run in your browser only; Image & PDF tools upload files to the backend when you run them.

JSON TOML Converter

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

About JSON TOML Converter

TOML is the config format with feelings — readable, typed, and finicky about dates, arrays of tables, and inline versus block notation. It is the native format for Cargo.toml in Rust, pyproject.toml in Python, and Hugo and Zola site configs. This converter translates between TOML and JSON without needing to remember syntax for arrays of tables or RFC 3339 datetimes. Rust developers porting Cargo.toml, Python devs migrating to pyproject.toml, and static-site users adjusting Hugo config all use this to skip the format-learning curve. The converter is TOML 1.0 spec compliant — the version Cargo and pyproject.toml expect. RFC 3339 datetimes survive both directions. Comments are TOML-only and lost when converting to JSON; the tool warns you upfront to prevent accidentally discarding documentation.

Why use JSON TOML Converter

TOML 1.0 Spec Compliant

Outputs spec-conformant TOML 1.0, the version Cargo, uv, and pyproject.toml all expect. Handles correct quoted versus bare key rules, proper datetime formatting, and the distinction between TOML 1.0 and the older 0.5 spec that some tools still use.

Array of Tables Support

[[bin]] and [[example]] sections common in Cargo.toml round-trip cleanly in both directions. Many converters mangle these into objects with numeric array indices — this one produces correct [[section]] blocks every time.

Native Datetime Round-Trip

RFC 3339 datetimes like 2025-05-07T14:30:00Z survive both conversion directions. JSON represents them as ISO 8601 strings; TOML restores them as typed datetime values so consumers see the correct type, not a raw string.

Inline vs Standard Tables

Choose between compact inline tables ({key = val}) for short configs and expanded [section] tables for readability. The choice affects how the output looks when read by humans — not how it is parsed by tooling.

Comments-Aware Round Trip Warning

Comments are a TOML-only concept. The tool tells you upfront, before conversion, that comments will be lost when going to JSON. This prevents silently discarding documentation you wrote in the config file.

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 JSON TOML Converter

  1. Pick conversion direction: TOML → JSON or JSON → TOML
  2. Paste the source config content into the input panel
  3. For TOML output, choose between inline tables ({key = val}) and expanded [section] tables
  4. Decide how to handle JSON null values (TOML has no null — omit the key or use empty string)
  5. Watch live conversion with errors highlighted and line numbers shown for malformed input
  6. Copy the result or download it with the correct extension (.toml or .json)

When to use JSON TOML Converter

  • Inspecting a Cargo.toml file as JSON to programmatically extract dependency versions or feature flags
  • Migrating a Python project from setup.cfg or setup.py to pyproject.toml by converting existing JSON config
  • Adjusting a Hugo or Zola static site config.toml 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
  • Reviewing a dependency manifest or lock file in a more familiar JSON format before making changes

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"

Output: { "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"} ] }

Output: [[servers]] name = "alpha" ip = "10.0.0.1" [[servers]] name = "beta" ip = "10.0.0.2"

Datetime preserved

Input: release_date = 2025-05-07T14:30:00Z build_id = 42

Output: { "release_date": "2025-05-07T14:30:00.000Z", "build_id": 42 }

Tips

  • TOML has no null type — converting JSON null fields will either omit the key or use an empty string; pick the convention your reader expects.
  • Cargo.toml expects the [package] section near the top; when converting back from JSON, verify section ordering looks reasonable or rustc may emit warnings.
  • Use inline tables only for small configs with three or fewer keys — larger tables are far more readable as standard [section] blocks.
  • TOML datetimes are RFC 3339; round-tripping through JSON preserves the string value but loses the type — do not manipulate them as raw strings if precision matters.
  • 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 represent the same data structure; the choice is purely cosmetic and affects readability.
Will my TOML comments be preserved when converting to JSON?
No. JSON has no comment syntax, so all TOML comments (lines beginning with #) are discarded when converting to JSON. The tool shows a warning about this before conversion. Keep the original TOML in version control if comments matter.
How are TOML datetimes represented in JSON?
TOML RFC 3339 datetimes are serialised as ISO 8601 strings in JSON (e.g. "2025-05-07T14:30:00.000Z"). On the return trip from JSON to TOML, strings matching the RFC 3339 pattern are restored as typed TOML datetime values.
Can I convert a Cargo.toml file?
Yes. Cargo.toml is standard TOML 1.0 and converts cleanly. [[bin]], [[example]], and [[test]] array-of-table sections round-trip correctly. The [package] table, [dependencies], and [features] sections all convert to predictable JSON objects.
Does it support TOML 1.0 features like dotted keys?
Yes. Dotted keys like a.b.c = "val" are treated as equivalent to nested tables and convert to {"a": {"b": {"c": "val"}}} in JSON. On the return trip, deeply nested JSON objects are emitted as standard [section] tables.
What happens to JSON nulls — does TOML support them?
TOML has no null type. When converting JSON to TOML, null values are either omitted from the output or replaced with an empty string, depending on your setting. Choose based on what your TOML reader expects for absent keys.
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. This is the correct Cargo.toml convention and matches rustc's expectations.
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.