JSON to YAML Converter
Convert JSON to YAML and YAML back to JSON in your browser, with a choice of indent, clear error messages and support for multi-document YAML.
Reviewed 23 November 2026 · Free · No account needed
How to use
- Choose the direction: JSON to YAML or YAML to JSON.
- Paste your text, or open a .json or .yaml file.
- Pick the indent you prefer; the result updates as you type.
- Copy the output or download it as a file.
Example
Input: {"name":"toolnexo","tags":["a","b"]}
Output: name: toolnexo tags: - a - b
How it works
JSON is parsed with the browser's JSON parser. YAML is parsed and written with the open-source yaml library, loaded only when you open this tool. Both run entirely on your device.
JSON to YAML: JSON.parse the text, then serialise the value as block-style YAML with your indent and no line folding. YAML to JSON: parse every document, resolve anchors and merge keys, then JSON.stringify with your indent.
{"server":{"port":80}} becomes "server:\n port: 80". Going back gives the same object.
Limits and edge cases
- YAML comments are dropped when converting to JSON, because JSON has no comments.
- Very large integers beyond JavaScript's safe range may lose precision when read from JSON.
- A YAML file with several documents separated by --- becomes a JSON array.
- Input is limited to about 2 million characters.
- Anchors, aliases and the <<: merge key are expanded in the JSON output.
- Empty YAML or the YAML value null converts to JSON null.
- Invalid input shows the parser message instead of failing silently.
Privacy
The conversion runs in this browser tab. Your JSON and YAML are never uploaded or stored.
About this page
Written and reviewed by Toolnexo on 23 November 2026. The limits above describe the published tool, not an idealised version of it. If a result looks wrong or the page is unclear, email [email protected] with the tool URL and what you entered. Corrections are published here.
Guides that use JSON to YAML Converter
- Common YAML errors and how to fix them6 min read
Related tools
Questions about JSON to YAML Converter
How do I convert JSON to YAML?
Choose JSON to YAML, paste the JSON on the left, and the YAML appears on the right. Pick 2 or 4 spaces of indent, then copy or download the result. Because YAML is a superset of JSON in practice, the output keeps the same keys, values and order.
Does converting YAML to JSON lose anything?
Comments are lost, since JSON cannot hold them. Anchors and aliases are expanded into repeated values, and YAML-only types such as dates in some schemas become plain strings or numbers. Data such as strings, numbers, booleans, lists and mappings is preserved.
Can I convert Kubernetes or docker-compose files?
Yes. Paste the YAML, switch to YAML to JSON, and the merge keys used in many compose and CI files are resolved. A file with several documents separated by --- becomes a JSON array with one item per document.
Is my data sent anywhere?
No. Parsing and conversion happen in your browser, so configuration files with secrets or internal names stay on your device. Even so, avoid pasting live credentials into any tool you do not control.