inyourbrowser.com

YAML to JSON Converter

Paste a YAML document and get the equivalent JSON output instantly. The converter walks the parsed tree and emits valid JSON with two-space indentation for easy reading.

Input YAML
Output JSON

ACTION

INDENT

Runs entirely in your browser

How it works

The tool uses js-yaml, a YAML 1.2 parser written in pure JavaScript. The library runs in a Web Worker that starts when the page opens; it parses the input into an in-memory tree and re-emits it using the chosen indentation. Validation surfaces any parser error along with the line where it occurred.

Processing runs in your browser

All parsing and conversion happens locally in your browser tab. Our servers are not involved at any point.

Frequently asked questions

Why do yes, no, on and off stay strings in the JSON?
The converter follows YAML 1.2, where only true and false are booleans, in lower case, capitalised or all capitals (True, TRUE). The YAML 1.1 words yes, no, on, off and y are read as plain text, so enabled: yes becomes "enabled": "yes". Write true or false when the tool that reads the JSON expects a boolean.
How are YAML anchors and aliases handled?
Anchors and aliases are resolved during parsing so the output JSON contains the fully expanded value at each reference site. Merge keys (<<: *anchor) are merged into the surrounding mapping. Because every alias is written out in full, a short document can expand to a very large result; if the JSON would be far larger than the input, the tool shows an error instead of converting it.
What happens with YAML-only types like dates or sets?
Dates are kept exactly as written, as strings. Tagged values such as !!set, !!binary or custom tags like !Ref are rejected by the safe schema with an error, so remove or replace them before converting. The special numbers .inf and .nan have no JSON equivalent and become null.
Can I convert multi-document YAML files?
Yes. Every document is converted. Several documents become a JSON array with one entry per document, in the original order; a single document becomes a single JSON value.
Will the output be valid JSON?
Yes. The output is generated with JSON.stringify and parses back as standard JSON in every environment.

Last reviewed September 30, 2026

Other pages for this tool

Related tools

XML formatter
Pretty-print, minify, and validate XML. Uses the browser's native DOMParser.
JSON formatter
Pretty-print, minify, validate, and sort JSON keys. Instant output.
SQL formatter
Beautify and format SQL queries. Supports MySQL, PostgreSQL, T-SQL and standard SQL.
CSV ↔ JSON
Convert CSV to JSON and JSON back to CSV. Handles quoted fields and downloads.