JSON to YAML
Convert JSON to YAML.
Loading…
About JSON to YAML
Configuration files are often written in YAML while the data you start from is JSON. There is no Convert button here: the YAML panel updates on every keystroke, so you can paste, tweak a value and watch the result change. Nested objects and lists are indented with two spaces, empty containers become [] and {}, and multi-line strings are written as block literals. Anything that YAML might read as a boolean, number or date is quoted.
Features
- Output updates on every keystroke, with no button to press
- Strings such as yes, on, null or 1.0 are quoted so they stay strings
- Multi-line strings are written as block literals
- Two-space indentation for nested objects and lists
- Number literals are copied exactly as written
- Empty arrays and objects are written as [] and {}
Limitations
- Keys keep their JSON order, and there are no options to sort them or change the indentation.
- The output is plain block-style YAML; it does not add comments, anchors or tags.
- Download saves the text as output.txt and needs a free account; Copy Output does not.
- JSON nested more than 1,000 levels deep is refused.
How it works
- Paste your JSON into the JSON Input panel.
- Read the YAML Output panel, which updates as you type or edit.
- If the JSON has a syntax error, read the error message in the middle column and fix the input.
- Use Copy Output to copy the YAML, or Download to save it.
- Press Clear All to empty both panels.
Example input
{
"name": "Auro",
"tags": ["json", "yaml"],
"active": true
}Frequently asked questions
- Strings that YAML would otherwise read as something else are quoted: yes, no, on, off, true, null, anything that looks like a number or a date, and text with a colon or a space at the start. The quotes keep them strings when the YAML is loaded again.
- That is what the quoting rules are for: the output is meant to load back to the same values. Numbers keep the digits you wrote, so 1.10 stays 1.10 instead of becoming 1.1.
- As block literals that start with a pipe, with each line indented under the key. A string with control characters, or one that starts with a blank line, falls back to a quoted string with escapes.
- Use the YAML to JSON converter. It reads the same two-space block style and prints the result as indented JSON.
