JSON / YAML / TOML Converter
Convert between JSON, YAML, and TOML data formats. Paste your data, pick a target format, and convert instantly.
What is the difference between YAML and JSON?
They describe the same data model β maps, lists, strings, numbers, booleans β with different syntax. JSON uses braces and brackets, is strict, and has no comments, which makes it ideal for machine-to-machine APIs. YAML uses indentation, allows comments, and quotes are usually optional, which makes it friendlier for human-edited config. In fact, valid JSON is also valid YAML 1.2, so every JSON document already parses as YAML β the reverse is not true.
When should I use TOML instead of YAML?
TOML was designed as an obvious, minimal config format: key = value pairs grouped under [section] tables, with no significant whitespace and no implicit typing surprises. It is the native format of Rust's Cargo.toml, Python's pyproject.toml, and Netlify and Hugo configs. Choose TOML for flat-to-moderately-nested application settings; choose YAML when you need deep nesting or multi-document files like Kubernetes manifests; choose JSON when machines are the primary audience.
How does this converter work?
Paste data in JSON, YAML, or TOML and the tool detects the input format automatically β or override it manually. Pick a target format and hit Convert; a pretty-print toggle switches JSON output between indented and minified, and one click copies the result. Parsing and serialization run entirely in your browser; nothing is uploaded, so it is safe to convert configs that contain credentials, internal hostnames, or API keys.
Why did my YAML fail to convert?
The usual suspects: tab characters (YAML forbids tabs for indentation β use spaces), inconsistent indent depth between sibling keys, a missing space after the colon (key:value instead of key: value), or unquoted special strings. Watch for the Norway problem: in older YAML 1.1 parsers, unquoted no, yes, on, and off become booleans, so the country code NO silently turns into false. Quote any string that could be misread.
How do I convert YAML to JSON on the command line?
The standard tool is yq: run yq -o=json file.yaml to emit JSON, and yq -P file.json to go the other way with pretty YAML output. For JSON-to-JSON reshaping and pretty-printing, jq . file.json is the classic. Both are single-binary installs available via apt, dnf, or brew. This page is handy when you are on a machine without yq installed or just want instant visual feedback while editing.
Can converting between formats lose information?
Yes, in specific ways. Comments exist in YAML and TOML but not JSON, so they are dropped on conversion. YAML anchors and aliases are expanded into plain values. TOML requires a table (object) at the top level, so a bare JSON array cannot become valid TOML. Key order may change, which only matters if a downstream tool diffs files textually. The underlying data β values and structure β survives every round trip.
Can I use this to validate and tidy files?
Yes β converting a format to itself is a quick validation pass. Paste hand-edited YAML and convert it to YAML to confirm it parses, or paste minified JSON from an API response and pretty-print it for review. Syntax errors are reported with a message instead of silently producing wrong output, which makes this a fast first check before committing a config change or feeding a file to a deployment pipeline.