How to convert JSON and TOML
TOML is popular for settings in development tools; JSON appears in APIs and machine-readable output. These two formats do not have identical value types, so a restricted flat mapping is safer than guessing how to convert nested structures.
Example JSON input
{"package":"demo","enabled":true,"retries":3}Example TOML output
package = "demo"
enabled = true
retries = 3Convert simple named settings
JSON → TOML writes scalar assignments for strings, numbers and Booleans. TOML has no null value, so a null field cannot be converted without changing meaning and is rejected instead of silently disappearing.
Know what TOML syntax is excluded
The reverse direction accepts simple flat key/value lines. Tables, arrays of tables, date/time values and multiline strings require additional parsing rules not implemented here. A real Cargo or pyproject.toml file may need a more complete tool.
Test the output in context
Do not assume matching keys prove equivalent meaning. Compare expected value types, quote handling and the receiving program's validation. Keep the original configuration and run its parser or tests after making changes.
Frequently asked questions
What happens to a JSON null?
Conversion to TOML rejects it because TOML has no equivalent null scalar.
Can I convert complex TOML tables?
Not with this lightweight converter. It is intended for flat assignments only.