YAML to JSON / JSON to YAML
Convert between YAML and JSON in either direction. Strict YAML 1.2 parsing with anchor/alias resolution, configurable JSON indentation, line-level error reporting, and drag-and-drop file support. Everything runs in your browser.
About YAML and JSON
JSON (JavaScript Object Notation) is the de-facto interchange format for web APIs — strict, machine-friendly, and trivially parsed in every language. YAML (YAML Ain't Markup Language) was designed for human readability: indentation replaces braces, comments are allowed, and complex strings can span multiple lines without escaping.
Why convert between them?
- Migrating between tools — Kubernetes manifests are YAML, but many APIs return JSON
- Hand-editing config — convert opaque JSON into readable YAML, edit, then convert back
- Documentation — embed JSON examples into YAML-based docs (or vice versa)
- Debugging API responses — YAML's hierarchy is easier to scan than dense JSON
YAML 1.2 features supported
The converter uses the js-yaml library implementing the YAML 1.2 spec. It correctly handles block and flow style, anchors (&name) and aliases (*name), explicit type tags, quoted vs unquoted strings, multi-line block scalars (| and >), and the merge key (<<:).
JSON output formatting
Choose between 2-space, 4-space, tab, or fully minified output. Minified is useful when shipping JSON over the wire or embedding in a single line. Tab indentation is friendlier for many editors with custom tab widths.
Common pitfalls
- Mixed tabs and spaces in YAML cause parse errors — pick one and stick with it (spaces preferred)
- Unquoted strings starting with
:,#,?,-can be misparsed — quote them - Norway problem: in YAML 1.1, the country code
NOparsed asfalse. YAML 1.2 (used here) requires explicittrue/false, so this is no longer an issue - Numbers with leading zeros: in YAML 1.1
012was octal; in YAML 1.2 it is just the number 12
Frequently Asked Questions
&name) and aliases (*name) are fully resolved during parsing, so the resulting JSON contains the expanded value at every reference point.