Skip to content

Convert YAML to JSON online

Parse YAML into JSON in your browser — comments, anchored indentation, block scalars and multi-document streams, with exact line and column errors.

  • Runs in your browser
  • Files are never uploaded
  • Free, no account
Parsing and output
Comments and block scalars are handled; errors show the exact line.

YAML streams separated by ---

YAML 1.1 behaviour. Off means they stay strings, as YAML 1.2 specifies.

YAML input

JSON output

How to convert YAML to JSON

  1. Paste the YAML or drop a .yaml / .yml file onto the left pane.
  2. Read any error. Problems are reported with the exact line and column and the offending line printed underneath with a caret, so you can fix the file rather than guess.
  3. Pick the boolean rules. Leave the toggle off for YAML 1.2 behaviour, or turn it on if your file relies on yes and no meaning true and false.
  4. Handle multiple documents. A stream separated by --- can become a JSON array or just its first document.
  5. Copy or download the JSON, minified or pretty printed.

What the parser understands

YAML feature Supported Notes
Block mappings and sequences Yes Any nesting depth, including maps that start on a - line
Flow collections Yes [a, b] and {k: v}, including across several lines
Block scalars Yes |, > with +/- chomping and indentation digits
Quoted scalars Yes Single quotes with '', double quotes with \n, \t, \uNNNN
Comments Yes Recognised and skipped, including at end of line — JSON cannot keep them
Multi-document streams Yes --- and ... boundaries
Anchors, aliases, merge keys No Reported as an error rather than dropped silently
Custom tags, explicit ? key No Rare outside hand-written YAML; also reported clearly

The three mistakes that break most YAML files

  • Tabs. YAML forbids tabs in indentation entirely. Editors that expand tabs to spaces hide the problem until a build fails; here you get “Tabs cannot be used for indentation” with the exact line.
  • An unquoted value containing “: ”. title: Report: Q3 is not a string — the parser sees a nested mapping and complains. Quote the value.
  • Inconsistent indentation. Sibling keys must line up in the same column. A single extra space produces “this line is indented 3 spaces but the mapping around it uses 2”.

Type resolution

Plain scalars are resolved with the YAML 1.2 core schema: null and ~ become null; true/false become booleans; decimal, hexadecimal (0x1f), octal (0o17) and binary (0b1011) integers become numbers, as do floats and exponents. Underscores used as digit separators are removed. Everything else stays a string — including dates, which JSON has no type for.

Two YAML values have no JSON equivalent: .inf and .nan. They are written as null and a notice tells you it happened, rather than emitting invalid JSON that fails at the other end.

Private by construction

The YAML parser here is hand-written and bundled with the page — no library download, no API call, no upload. Kubernetes manifests, CI pipelines and Ansible inventories often name internal hosts and services; none of that leaves your machine.

Questions

Does it validate my YAML?

Yes. Anything the parser cannot read is reported with the exact line and column plus the offending line, so tab indentation or a missing quote is easy to find.

Are yes and no treated as booleans?

Not by default — YAML 1.2 says only true and false are booleans, so yes/no/on/off stay strings. Flip the toggle to get the older YAML 1.1 behaviour many config files rely on.

What about a file with several --- documents?

Multi-document streams are supported. Choose whether to convert only the first document or combine every document into a single JSON array.

Are anchors and aliases supported?

No. &anchor and *alias references are reported as a clear error rather than being silently dropped. Expand them in your source file first.

What happens to .inf and .nan values?

JSON has no way to represent infinity or not-a-number, so those values are written as null and a notice explains the substitution.