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.

YAML Input 0 chars · 0 lines · drop file to load
JSON Output 0 chars · 0 lines

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?

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

Frequently Asked Questions

Is my input sent to any server?
No. Parsing and conversion run entirely in your browser using js-yaml loaded from a CDN. Once the page is open, no data leaves your machine.
Does it support YAML anchors and aliases?
Yes. Anchors (&name) and aliases (*name) are fully resolved during parsing, so the resulting JSON contains the expanded value at every reference point.
Why does my YAML produce a parse error?
The most common causes are inconsistent indentation, unquoted strings with special characters, and missing colons after mapping keys. The error message shows the line and column where parsing failed — start there.
Can I convert JSON Schema to YAML?
Yes — JSON Schema documents are just JSON, so paste them in JSON → YAML mode and you'll get a YAML representation. The schema semantics are preserved.
Are YAML comments preserved when round-tripping?
No. JSON has no concept of comments, so YAML comments are lost during YAML → JSON. Converting back to YAML produces clean, comment-free output. This is a fundamental limitation of any YAML/JSON converter, not a tool restriction.