Two sides of the same conversion. TOML → JSON parses a TOML config into a JSON object; JSON → TOML does the reverse, serializing JSON into clean TOML. Together they let you move data between the human-friendly config format and the API-native one — both run 100% locally.
Use TOML → JSON when
- You have a TOML config (Cargo.toml, pyproject.toml) and need it as JSON.
- An API or tool expects JSON but your source is TOML.
- You're migrating or bridging a TOML-based project into a JSON pipeline.
Use JSON → TOML when
- You have JSON data that needs to become a readable TOML config.
- You're generating a config file for a TOML-based toolchain.
- You want hand-editable output — TOML is friendlier for humans to tweak.
Side by side
| TOML → JSON | JSON → TOML | |
|---|---|---|
| Direction | TOML → JSON | JSON → TOML |
| Input | TOML | JSON |
| Output | JSON | TOML |
| Handles nested tables? | Yes | Yes |
| Preserves types? | Yes — dates, numbers, booleans | Yes — within TOML's types |
| Runs 100% locally | Yes | Yes |
under the hood
Powered by the same TOML engine (smol-toml) in both directions, so a round trip preserves the core data. TOML's richer date/time types map to strings in JSON, so a round trip may normalize those.
bottom line
Use TOML → JSON when you're consuming a config; use JSON → TOML when you're producing one. They're mirrors, and you'll often use both when bridging a TOML project and a JSON API.