YAML to JSON
Convert YAML to JSON. Paste YAML on the left; the JSON output builds on the right as you type.
name: vayce
tools: 224
categories:
- images
- text-and-data
active: true
becomes
{
"name": "vayce",
"tools": 224,
"categories": ["images", "text-and-data"],
"active": true
}
YAML mappings become JSON objects and YAML sequences become JSON arrays. Unquoted scalars that look like a number or boolean, 224 and true here, convert to the matching JSON type rather than staying strings.
What doesn’t survive
JSON has no comments and no anchors, so two YAML features disappear on this side of the conversion. A # note next to a key is gone in the output. An anchored value referenced elsewhere with *alias gets written out as a full duplicate instead of a shared reference, since JSON has no way to express “the same object as above.”
Parse errors
YAML’s indentation rules are stricter than they look: mixing tabs and spaces, or indenting a nested key by an odd number of spaces relative to its parent, produces a parse error rather than a guess. The input pane’s error footer shows the line and column the parser gave up at, taken from the same location YAML’s own error messages report.
Formatting first
If your YAML has formatting issues you want to fix without converting it, the YAML formatter validates and pretty-prints YAML in place. Come back here once the source is clean and you actually need JSON, CSV, XML, or TOML out of it.