TOML to JSON Converter

Convert TOML configuration files to JSON format and back

Convert TOML configuration files (Cargo.toml, pyproject.toml) to JSON format. Supports tables, arrays of tables, inline tables, strings, numbers, booleans, and datetimes.

What is TOML to JSON Converter?

TOML (Tom's Obvious Minimal Language) is a configuration format built around key = value pairs, [table] headers, and [[array_of_tables]] syntax, designed for human readability. It is the standard for Rust's Cargo.toml and Python's pyproject.toml. JSON is the universal data interchange format used by APIs, databases, and virtually every programming language. This converter bridges the two: it parses TOML into an in-memory representation and serializes it as formatted JSON, or takes a JSON object and emits valid TOML with proper table headers, arrays of tables, and type-specific serialization. The bidirectional toggle lets you switch directions without changing tools.

How to Use

  1. Paste your TOML or JSON content into the input area — the tool auto-detects the direction based on your toggle selection.
  2. Use the direction toggle to switch between TOML → JSON and JSON → TOML conversion.
  3. Click 'Convert' to parse the input and generate the output in the target format.
  4. Review the formatted output on the right — JSON output is pretty-printed with 2-space indentation, and TOML output uses proper section headers.
  5. Copy the result and use it in your application, configuration file, or data pipeline.

Why Use This Tool?

Convert Cargo.toml and pyproject.toml to JSON for programmatic processing by APIs, build tools, or data pipelines
Bidirectional conversion eliminates the need for separate tools — toggle between TOML → JSON and JSON → TOML instantly
Full TOML v1.0 support including tables, arrays of tables, inline tables, dotted keys, and datetime values
Proper type handling preserves integers, floats, booleans, and strings without loss during round-trip conversion
Browser-only processing keeps your configuration files private — nothing is uploaded or stored on any server

Tips & Best Practices

  • TOML tables [section] become nested JSON objects — the section name becomes the key and its contents become the value.
  • TOML arrays of tables [[items]] become JSON arrays of objects, which is the idiomatic way to represent repeated structures in both formats.
  • When converting JSON to TOML, null values are omitted since TOML has no null type — consider using empty strings or default values instead.
  • Dotted keys in TOML (server.host = "localhost") create the same nested structure as [server] host = "localhost" — both produce the same JSON.
  • Inline tables in TOML ({key = value}) become compact JSON objects, which is useful for short dependency declarations.

Frequently Asked Questions

How are TOML types mapped to JSON types?

TOML strings become JSON strings, integers become JSON numbers, floats become JSON numbers, booleans become JSON true/false, arrays become JSON arrays, and tables become JSON objects. TOML datetime values are preserved as strings in JSON since JSON has no native datetime type. TOML has no null type, so absent keys simply do not appear in the JSON output.

When should I NOT use this converter?

Avoid this tool when your TOML uses features that have no JSON equivalent and require special handling — such as local dates without times, local times without dates, or custom TOML extensions. Also, very large TOML files with hundreds of array-of-table entries may produce JSON that is harder to read than the original TOML.

Does this support Cargo.toml and pyproject.toml?

Yes. The parser handles all standard TOML v1.0 features used in Cargo.toml and pyproject.toml, including tables, arrays of tables, inline tables, dotted keys, and multiline strings. These files convert correctly in both directions.

How are null values handled when converting JSON to TOML?

TOML does not have a native null type. When converting JSON to TOML, keys with null values are omitted from the output. If you need to represent absence, consider using empty strings or a sentinel value before conversion.

What happens with TOML inline tables?

Inline tables like {version = "1.0", features = ["derive"]} become compact JSON objects. When converting back from JSON to TOML, small nested objects may be rendered as inline tables for readability, while larger ones use full [section] headers.

Is my configuration data sent to any server?

No. All parsing and conversion runs entirely in your browser. Your TOML and JSON content never leave your device. No data is collected, stored, or transmitted to any server.

Real-world Examples

Cargo.toml to JSON for Build Analysis

Convert a Rust Cargo.toml into JSON for programmatic dependency analysis or build tool integration.

Input
[package]
name = "my-rust-app"
version = "0.1.0"
edition = "2021"

[dependencies]
serde = { version = "1.0", features = ["derive"] }
tokio = { version = "1", features = ["full"] }

[profile.release]
opt-level = 3
lto = true
Output
{
  "package": {
    "name": "my-rust-app",
    "version": "0.1.0",
    "edition": "2021"
  },
  "dependencies": {
    "serde": {
      "version": "1.0",
      "features": [
        "derive"
      ]
    },
    "tokio": {
      "version": "1",
      "features": [
        "full"
      ]
    }
  },
  "profile": {
    "release": {
      "opt-level": 3,
      "lto": true
    }
  }
}

JSON Config to TOML for Hugo

Convert a JSON site configuration into TOML format for Hugo or other TOML-based static site generators.

Input
{
  "title": "My Blog",
  "baseURL": "https://example.com",
  "params": {
    "description": "A personal blog",
    "author": "Jane Doe"
  },
  "markup": {
    "highlight": {
      "style": "dracula",
      "lineNos": true
    }
  }
}
Output
title = "My Blog"
baseURL = "https://example.com"

[params]
description = "A personal blog"
author = "Jane Doe"

[markup.highlight]
style = "dracula"
lineNos = true

Related Tools