YAML to JSON
Convert YAML to JSON.
Loading…
About YAML to JSON
Compose files, CI workflows and application settings are written in YAML, but scripts and APIs often want JSON. Paste the YAML, press the button and the parsed document appears as indented JSON. Anchors and aliases are copied out in full, numbers, booleans and null are typed, and a syntax error tells you the line and column to fix. Only one document is read at a time.
Features
- Parses YAML into two-space-indented JSON
- Anchors and aliases are expanded into full copies
- Numbers, booleans and null are typed; yes, no, on and off stay strings
- Syntax errors name the line and column
- Infinity and NaN are written as .inf and .nan strings instead of becoming null
Limitations
- Only one document is accepted; a file with several documents separated by --- is rejected.
- Merge keys are not applied: a << entry comes out as a key named <<, so inherited values are not merged in.
- Duplicate mapping keys and tab indentation are errors, and explicit tags such as !!binary or !!timestamp are not supported.
- A number like 1.0 becomes 1 in the JSON; quote it in the YAML if it must stay text.
How it works
- Paste your YAML into the YAML Input panel.
- Select Convert to JSON.
- Read the indented result in the JSON Output panel.
- If the middle column shows an error, fix the line and column it names and convert again.
- Use Copy Output to copy the JSON, or Clear All to start over.
Example input
name: Auro
tags:
- json
- yaml
active: trueFrequently asked questions
- The parser follows the newer YAML rules, where only true and false, in any of the usual capitalizations, are booleans. yes, no, on and off remain strings. If your file relies on the older behavior, change those values to true or false.
- An alias is replaced by a full copy of the anchored value, so the JSON repeats it. The merge key << is not expanded, though, and appears as a literal key holding the referenced object.
- The tool reads a single document, and a stream with several documents gets the message that one document was expected. Convert each document separately by pasting them one at a time.
- YAML reads 1.0 as a number, and JSON writes the number as 1. Put quotes around it in the YAML, as in "1.0", to keep the text exactly.
- No. The parser is loaded into the page and runs in your browser, so the text you paste is not sent to our servers.
