TOML Converter — Free Online Tool

Convert TOML to JSON, YAML, INI. Validate TOML syntax, parse config files. Cargo.toml, pyproject.toml, Rust, Python configuration format.

Use this free online TOML Converter directly in your browser. No signup required, no data leaves your device. Part of Utilier — a collection of 133+ developer utilities.

What is TOML Converter (JSON, YAML, INI) & Validator?

TOML converter transforms TOML (Tom's Obvious, Minimal Language) configuration files to JSON, YAML, or INI format, and vice versa. TOML syntax: key-value pairs (name = 'value'), tables ([section]), arrays ([[array]]), nested structures ([database.connection]). Common in: Cargo.toml (Rust package manager), pyproject.toml (Python packaging), Hugo config, Netlify config, GitHub workflows. Tool converts: TOML → JSON (API compatibility), TOML → YAML (Kubernetes/Docker configs), JSON/YAML → TOML (human-readable config). Validates TOML syntax (parse errors, type errors, invalid keys). Shows parsed structure (nested objects, arrays, data types). Useful for: config file migration (INI → TOML, JSON → TOML), debugging TOML syntax (why doesn't Cargo build?), learning TOML format (compare with JSON/YAML), API integration (convert TOML config to JSON for APIs).

  • TOML syntax: Key-value: name = 'John', age = 30. Tables: [database] (section), [database.connection] (nested). Arrays: colors = ['red', 'blue'], [[products]] (array of tables). Types: string ('text', "text", '''multiline'''), integer (42), float (3.14), boolean (true/false), datetime (2024-01-15T14:30:00Z).
  • Convert to JSON/YAML: TOML → JSON: {"name": "John", "age": 30}. TOML → YAML: name: John\nage: 30. Preserves structure (tables → objects, arrays → arrays). Use for API compatibility (JSON) or Kubernetes configs (YAML).
  • Convert from JSON/YAML: JSON → TOML: {"name": "John"} → name = 'John'. YAML → TOML: name: John → name = 'John'. Human-readable config (TOML) from machine-readable JSON/YAML.
  • TOML validation: Checks syntax: missing quotes (name = John ❌, name = 'John' ✓), invalid keys (1name ❌, name1 ✓), wrong brackets ([section ❌, [section] ✓). Shows line number of error.
  • Config file examples: Cargo.toml (Rust dependencies: [dependencies]\nserde = '1.0'), pyproject.toml (Python packaging: [project]\nname = 'myapp'), Hugo config (site settings: baseURL = 'https://example.com').

Why use toml converter?

TOML is human-readable (more than JSON), less complex than YAML (no indentation errors). Converting between formats enables interoperability.

  • Human-readable config: TOML easier to read than JSON (no {}, less punctuation). name = 'John' vs {"name": "John"}. Comments supported (# comment). Good for config files (Cargo.toml, pyproject.toml).
  • Validate Cargo.toml / pyproject.toml: Rust/Python build failures often caused by invalid TOML (missing quotes, wrong brackets). Tool validates syntax, shows exact error (line 5: expected string, got integer).
  • Convert for APIs: APIs expect JSON. TOML config → convert to JSON for API requests. Or API response JSON → convert to TOML for storage (human-editable config).
  • Migrate from INI to TOML: INI limited (no nested sections, no arrays). TOML superset of INI (supports nesting, arrays, types). Convert INI → TOML for richer config.
  • Compare with YAML: YAML indentation-sensitive (spaces vs tabs = error). TOML uses brackets (no indentation errors). Convert YAML → TOML to avoid indentation issues.
  • Learn TOML syntax: Interactive learning: paste TOML, see JSON output. Understand structure (tables, arrays). Compare TOML vs JSON (which is clearer?).

When to use toml converter

Use whenever you work with TOML config files (Rust, Python) or need format conversion.

  • Validating Cargo.toml (Rust dependencies, package metadata).
  • Validating pyproject.toml (Python packaging, PEP 518).
  • Converting TOML → JSON for API integration.
  • Converting JSON/YAML → TOML for human-readable config.
  • Migrating from INI to TOML (richer config format).
  • Debugging TOML syntax errors (Cargo build fails, pyproject invalid).
  • Learning TOML format (compare with JSON, YAML, INI).
  • Hugo/Netlify config (baseURL, build settings in TOML).

How to use toml converter

Paste TOML, convert to JSON/YAML/INI, or vice versa.

  1. Paste TOML content: Input TOML in left pane: name = 'John', age = 30, [database], host = 'localhost'. Or upload .toml file (Cargo.toml, pyproject.toml).
  2. Validate syntax: Tool parses TOML, checks for errors: missing quotes, invalid keys, wrong brackets. Shows error message with line number: 'Line 5: expected string, got integer'.
  3. Select output format: Choose: JSON (API compatibility), YAML (Kubernetes/Docker), INI (legacy config), or Pretty TOML (formatted TOML). Right pane shows conversion.
  4. View converted result: TOML → JSON: {"name": "John", "age": 30, "database": {"host": "localhost"}}. TOML → YAML: name: John\nage: 30\ndatabase:\n host: localhost.
  5. Reverse conversion (optional): Paste JSON/YAML in input, select 'To TOML'. Converts JSON {"name": "John"} → TOML name = 'John'. Useful for creating TOML from JSON APIs.
  6. Copy result: Click Copy to copy converted output. Paste into Cargo.toml, pyproject.toml, API request, Kubernetes config, etc.
  7. Download (optional): Download as .toml, .json, .yaml file. Save for version control (git), share with team, use in CI/CD pipeline.

Key features

  • Bidirectional conversion: TOML ↔ JSON, TOML ↔ YAML, TOML ↔ INI. Convert in both directions. Preserves structure (tables, arrays, types).
  • TOML validation: Syntax checking: missing quotes, invalid keys, wrong brackets, type errors. Shows line number and error message. Prevents Cargo/Python build failures.
  • Pretty formatting: Formats TOML with indentation, spacing, comments. Makes TOML readable (name = 'John' vs name='John'). Option: compact (minified) or pretty (formatted).
  • Type preservation: Preserves data types: string ('text'), integer (42), float (3.14), boolean (true), datetime (2024-01-15T14:30:00Z), array ([1, 2, 3]).
  • Nested structures: Handles nested tables: [database.connection], [[products]] (array of tables). Converts to nested JSON: {"database": {"connection": {...}}}.
  • Comment support: TOML comments: # This is a comment. Preserved in pretty TOML output. Stripped in JSON/YAML conversion (JSON/YAML don't support comments).
  • Offline parsing: Client-side TOML parser (JavaScript). No server upload. Fast, private, works offline. Parses TOML in browser.

Common use cases

  • Validate Cargo.toml: Rust package file: [package]\nname = 'myapp'\nversion = '0.1.0'\n[dependencies]\nserde = '1.0'. Tool validates syntax, checks for errors. Common: missing quotes (name = myapp ❌).
  • Validate pyproject.toml: Python packaging (PEP 518): [project]\nname = 'myapp'\nversion = '1.0.0'\ndependencies = ['requests>=2.25']. Tool checks syntax, ensures valid TOML.
  • TOML to JSON (API): TOML config: name = 'John', age = 30. Convert to JSON: {"name": "John", "age": 30}. Send to API (JSON body). Or store in database (JSON column).
  • JSON to TOML (config): API response: {"name": "John", "age": 30}. Convert to TOML: name = 'John'\nage = 30. Save as config.toml (human-editable, version control).
  • TOML to YAML (Kubernetes): TOML config: [database]\nhost = 'localhost'\nport = 5432. Convert to YAML: database:\n host: localhost\n port: 5432. Use in Kubernetes ConfigMap.
  • INI to TOML (migration): INI: [section]\nkey=value. TOML: [section]\nkey = 'value'. TOML supports nested sections ([section.subsection]), arrays (key = [1, 2, 3]). Migrate for richer config.

Examples

TOML conversion examples.

Simple TOML to JSON

name = 'John Doe'\nage = 30\nemail = 'john@example.com'
{\n "name": "John Doe",\n "age": 30,\n "email": "john@example.com"\n}

Key-value pairs → JSON object. String ('John Doe') → JSON string, integer (30) → JSON number.

TOML tables to nested JSON

[database]\nhost = 'localhost'\nport = 5432\n[database.credentials]\nusername = 'admin'\npassword = 'secret'
{\n "database": {\n "host": "localhost",\n "port": 5432,\n "credentials": {\n "username": "admin",\n "password": "secret"\n }\n }\n}

[database] → {"database": {...}}. [database.credentials] → nested object {"credentials": {...}}.

TOML array of tables to JSON array

[[products]]\nname = 'Hammer'\nprice = 9.99\n[[products]]\nname = 'Nail'\nprice = 0.99
{\n "products": [\n {"name": "Hammer", "price": 9.99},\n {"name": "Nail", "price": 0.99}\n ]\n}

[[products]] → array of objects. Multiple [[products]] blocks = array items.

JSON to TOML

{"name": "John", "age": 30, "active": true}
name = 'John'\nage = 30\nactive = true

JSON object → TOML key-value pairs. String → quoted, number/boolean → unquoted.

TOML validation error

name = John\nage = 30
Error: Line 1: expected string, got bare key 'John'. Strings must be quoted: name = 'John'.

name = John ❌ (bare key). name = 'John' ✓ (quoted string). Tool shows line number and error.

Technical reference

TOML syntax and data types:

Key-value pairs
name = 'John' (string), age = 30 (integer), score = 9.5 (float), active = true (boolean). Key: alphanumeric + underscore (no spaces). Value: quoted string, number, boolean, datetime, array, inline table.
Strings
Basic: 'single' or "double" quotes. Multiline: '''triple single''' or """triple double""". Literal (no escapes): 'C:\Users\file' or '''raw string'''. Escaped: "Line 1\nLine 2" (newline).
Numbers
Integer: 42, +17, -5, 1_000_000 (underscores for readability). Float: 3.14, -0.01, 1e6 (scientific notation), inf (infinity), nan (not a number).
Booleans
true or false (lowercase only). Not True, TRUE, or 1/0.
Datetime
ISO 8601: 2024-01-15T14:30:00Z (UTC), 2024-01-15T14:30:00-05:00 (offset), 2024-01-15 (date only), 14:30:00 (time only). Use for timestamps, dates.
Arrays
Inline: numbers = [1, 2, 3], mixed types not allowed (numbers = [1, 'two'] ❌). Multiline: numbers = [\n 1,\n 2,\n 3\n]. Nested: matrix = [[1, 2], [3, 4]].
Tables (sections)
[section] (header). Keys under section: [database]\nhost = 'localhost'\nport = 5432. Nested: [database.connection]\ntimeout = 30 → {"database": {"connection": {"timeout": 30}}}.
Array of tables
[[products]] (array item). Multiple [[products]] blocks = array. Example: [[products]]\nname = 'Hammer'\n[[products]]\nname = 'Nail' → {"products": [{"name": "Hammer"}, {"name": "Nail"}]}.
Inline tables
Single-line object: point = { x = 1, y = 2 }. No newlines allowed (must be one line). Use for small objects. Converts to JSON: {"point": {"x": 1, "y": 2}}.
Comments
# This is a comment (hash). Rest of line ignored. No block comments (/* */ not supported). Comments preserved in pretty TOML, stripped in JSON/YAML conversion.

Common mistakes to avoid

Forgetting to quote strings (name = John instead of name = 'John')

Why it happens: TOML requires quotes for string values. name = John parsed as bare key (syntax error). Common mistake when converting from INI (INI allows unquoted strings).

How to avoid it: Always quote strings: name = 'John' or name = "John". Numbers, booleans no quotes: age = 30, active = true. Tool shows error if quotes missing.

Using wrong bracket type ([section vs [[array]])

Why it happens: [section] = table (object). [[array]] = array of tables. Using [products] when you want array = error. Example: [products]\nname = 'A'\n[products]\nname = 'B' → error (duplicate [products]).

How to avoid it: Table (object): [section]. Array of tables: [[array]]. Multiple [[array]] blocks = array items. [section] can appear only once, [[array]] can repeat.

Mixing data types in arrays (numbers = [1, 'two', 3])

Why it happens: TOML requires homogeneous arrays (same type). numbers = [1, 'two', 3] → error (integer + string). Unlike JSON (allows mixed types).

How to avoid it: Arrays must be same type: numbers = [1, 2, 3] ✓, strings = ['a', 'b', 'c'] ✓. Mixed types: use array of inline tables: items = [{id = 1, name = 'A'}, {id = 2, name = 'B'}].

Using keys with spaces or special characters (my key = 'value')

Why it happens: TOML keys: alphanumeric + underscore/dash. Spaces not allowed (my key = error). Special chars (@, #, $) not allowed. Unlike JSON (allows any string as key with quotes).

How to avoid it: Use underscores or dashes: my_key = 'value' or my-key = 'value'. Or quoted keys: 'my key' = 'value' (TOML 1.0+). But unquoted preferred (more readable).

Not escaping backslashes in Windows paths (path = 'C:\Users\file')

Why it happens: Backslash is escape character in basic strings. path = 'C:\Users\file' → C:Usersfile (\U, \f treated as escapes). Need to escape backslashes: 'C:\\Users\\file' or use literal strings.

How to avoid it: Literal string (no escapes): path = 'C:\Users\file' (single quotes, no double backslash). Or basic string with escapes: path = "C:\\Users\\file" (double quotes, double backslash).

Frequently asked questions

What is TOML and why use it instead of JSON or YAML?

TOML = Tom's Obvious, Minimal Language (config file format). Human-readable (more than JSON), less complex than YAML (no indentation errors). Used by: Rust (Cargo.toml), Python (pyproject.toml), Hugo. Easier to edit by hand.

What is the difference between [section] and [[array]]?

[section] = table (object, can appear once). [[array]] = array of tables (can appear multiple times). Example: [[products]]\nname='A'\n[[products]]\nname='B' → {"products": [{"name":"A"}, {"name":"B"}]}.

Can TOML have comments like YAML?

Yes, # comment (hash symbol). Rest of line ignored. No block comments (/* */ not supported). Comments preserved in TOML, stripped when converting to JSON/YAML (JSON/YAML don't support comments natively).

How do I represent nested objects in TOML?

Dot notation: [database.connection]\nhost='localhost' → {"database":{"connection":{"host":"localhost"}}}. Or inline table: database = {host='localhost', port=5432}. Use [dot.notation] for clarity.

Can I convert YAML to TOML?

Yes, tool converts YAML → TOML. YAML: name: John\nage: 30 → TOML: name = 'John'\nage = 30. Preserves structure (nested objects, arrays). TOML = simpler, no indentation errors.

What is the difference between basic strings and literal strings in TOML?

Basic: 'text' or "text" (escape sequences: \n, \t). Literal: 'text' or '''text''' (no escapes, raw string). Use literal for paths: 'C:\Users\file' (no need to escape \). Basic for special chars: "Line 1\nLine 2".

How do I validate Cargo.toml or pyproject.toml?

Paste TOML content in tool. Tool parses and validates syntax. Shows errors with line numbers: 'Line 5: expected string'. Or use cargo check (Rust), pip install -e . (Python) to validate during build.

References

Privacy and availability

  • Runs entirely in your browser — zero server processing
  • No signup or account required
  • Works offline once loaded
  • Fast, lightweight, no external dependencies
  • Available as a browser extension for Chrome and Firefox