JSON to YAML and YAML to JSON
Convert between JSON and YAML in your browser. Edit either pane; the other updates live. Errors surface inline so you can fix them as you type.
JSON
YAML
JSON and YAML are the same shape with different syntax
JSON and YAML both represent the same data shape: mappings, sequences, scalars. JSON wraps everything in punctuation - braces, brackets, commas, quotes - which makes it unambiguous and easy to generate from code. YAML drops the punctuation in favour of indentation, which makes it more readable but more error-prone when written by hand.
Many tools accept both because they parse to the same in-memory structure. Kubernetes manifests, GitHub Actions workflows, CloudFormation templates - the canonical examples are written in YAML, but the underlying engines work with the parsed object graph.
When to use this tool
- Hand-editing a config you fetched as JSON.The API returned JSON; you'd rather edit YAML. Convert, edit, convert back, paste back into the request.
- Reading dense JSON.A deeply nested JSON object is hard to read. Convert to YAML and indentation makes the structure pop.
- Authoring a Helm or Kubernetes config from an API response.Many cluster APIs return JSON but accept YAML. This is the conversion that gets your output into the right format.
Worked examples
- Strings that look like numbers.YAML
version: "1.0"stays a string in JSON:"version": "1.0". Drop the quotes in YAML (version: 1.0) and JSON becomes"version": 1. Quoting matters. - Booleans.YAML 1.2 accepts
true / falseonly. Older parsers also acceptyes / no / on / off; js-yaml does not. If you have legacy YAML using those, quote them. - Null.YAML
~or empty value becomes JSONnull. In the other direction, JSONnullemits YAMLnull.
Common pitfalls
- Tabs in YAML.YAML forbids tabs for indentation. If your YAML mixes tabs and spaces, the parser will reject it. This tool surfaces the parse error inline.
- Trailing colons in keys.
name :(space before colon) is valid;name: valueneeds no space before the colon and at least one after. - Multi-line strings.YAML's block scalar styles (
|and>) preserve or fold newlines. JSON has no equivalent; multi-line content becomes a string with embedded\ncharacters. - Comments are lost.JSON has no comment syntax, so a JSON-to-YAML-to-JSON round-trip strips every comment you wrote in YAML. There's no way around this.
- Anchors and aliases.YAML's
&name/*namelet you reuse a sub-tree. When we serialize from JSON, we emit a fully expanded structure - no anchors. That's fine for most uses.