Developer Tools
JSON ↔ YAML Converter
Convert JSON to YAML or YAML to JSON locally, with nested arrays, strings and exact numbers.
Your results
Convert JSON and YAML with the intended data types
Convert JSON-compatible data between strict JSON and YAML 1.2 core syntax. The converter preserves JSON numeric tokens, including large integers, instead of first rounding them through JavaScript numbers. It converts data values, not the source document's formatting or an application's configuration schema. YAML comments, anchors and presentation choices do not survive a JSON conversion.
Step by step
- Paste text or open a local UTF-8 JSON, YAML, YML or TXT file. Choose JSON → YAML or YAML → JSON explicitly; opening a file does not detect the direction.
- Choose two or four spaces and optionally sort object keys. Process the input and resolve any syntax or unsupported-feature error. Sorting is recursive and uses case-sensitive lexical order; array order stays unchanged.
- Inspect strings, booleans, nulls and numbers, then copy, print or download converted.yaml or converted.json. If you edit the input or options, process again because the old output is cleared. Validate the converted file with the application that will use it.
Settings and limits
- Types and document rules
- Use one YAML 1.2 document with unique string keys and JSON-compatible values. Quote numeric-looking identifiers such as "00123"; an unquoted YAML 00123 becomes the number 123. Plain yes, on and ISO date text remain strings under core rules.
- Aliases and unsupported features
- Acyclic aliases expand into repeated values. Cycles, duplicate keys, non-string keys, unsupported tags and nonfinite numbers are rejected. YAML merge keys are not applied: <<: *base becomes an ordinary "<<" property, so expand intended inherited fields first.
- Size and complexity
- Input is limited to 2 MiB of UTF-8 text: 2,097,152 bytes. Output is limited to 8 MiB. Processing also stops beyond 128 nesting levels, 200,000 value nodes or 100 alias visits; a small file can still exceed those limits.
Worked example
Download types-example.json and choose JSON → YAML with two-space indentation and sorting off. Convert it and compare types-example.yaml. The quoted id and word stay strings, enabled stays false, and retries and large stay numbers.
Download the example files
Example input
{"id":"00123","word":"yes","enabled":false,"retries":3,"large":9007199254740993}Expected result
"id": "00123"
"word": "yes"
"enabled": false
"retries": 3
"large": 9007199254740993Now open types-example.yaml, switch explicitly to YAML → JSON and process again. The id should still be "00123" and the large integer should still be 9007199254740993. Remove the quotes around 00123 in the YAML and repeat: its value becomes numeric 123. That difference matters for identifiers even when both files are valid.
Questions and troubleshooting
Why does duplicate-key JSON fail here but format elsewhere?
JSON Formatter can warn about and retain duplicate keys. This converter rejects them because conversion into a mapping could change their meaning. Decide which value belongs in the source and remove the duplicate before converting.
Will comments and YAML inheritance be preserved?
JSON has no comments or anchors. Aliases are expanded, and merge keys are exported literally rather than applied as inheritance. Expand the intended data and review the result; conversion is not a faithful rewrite of every YAML feature.
Are large numbers safe in the destination application?
The converter preserves supported numeric spellings and large integer values, but a later program may parse them with lower precision. Use a quoted string when a numeric-looking value is an identifier, and test the destination application's parser.