How to use
- Paste your YAML or JSON into the input box. Use Load example to try a configuration file.
- Press YAML to JSON or JSON to YAML, and pick the indentation. Tab indentation applies to JSON only.
- Copy the result, or press Use result as input to convert it back and check the round trip.
Examples
a: 1 b: - x - y
→ {
"a": 1,
"b": [
"x",
"y"
]
}YAML to JSON with 2-space indentation.{"a":1,"b":["x","y"],"c":{"z":true}}→ a: 1 b: - x - y c: z: trueJSON to YAML.
defaults: &d retries: 3 tls: true staging: <<: *d retries: 5
→ staging becomes {"retries": 5, "tls": true}The anchor &d, the alias *d and the merge key << are expanded, and the local value wins over the merged one.How it works
YAML to JSON: the text is parsed by the open-source yaml library as YAML 1.2, with merge keys turned on, and the resulting data is written out as JSON with your chosen indentation.
JSON to YAML: the text is first read with the browser’s strict JSON parser, so it must be valid JSON, and then written as block-style YAML with the indentation you choose.
If the input is invalid, the tool shows the first line of the parser’s message, which usually names the problem and its line and column.
Sources
Frequently asked questions
- What is lost when I convert YAML to JSON?
- Comments, because JSON has no comments, and the structure of anchors and aliases, which become repeated copies of the values. Key order is kept. If you convert back, the comments do not return.
- How are non-text keys and special values handled?
- JSON keys must be text, so a YAML key such as 1 becomes "1". The YAML values .nan and .inf have no JSON form and become null.
- Why is yes or no not turned into true or false?
- This tool follows YAML 1.2, where only true and false are booleans. Older YAML 1.1 parsers also read yes, no, on and off as booleans, so a file written for one of those may convert differently here. Dates such as 2026-10-07 stay text.
- Can I convert a file with several YAML documents?
- Not in one go. A file with documents separated by --- needs to be converted one document at a time, and the tool tells you when it finds more than one.
- Is my data uploaded?
- No. The conversion runs in your browser and nothing is sent to a server.