YAML to JSON Converter and YAML Validator

Convert YAML to JSON instantly, with line-and-column errors that make it a YAML validator too. Free, and your config never leaves your browser.

Direction
JSON output

  
  
–

Parsed with js-yaml 4 (YAML 1.2) in your browser. Nothing is uploaded.

How the YAML to JSON converter works

The converter parses your YAML with js-yaml 4.1.1, the YAML library used by a large part of the JavaScript ecosystem, and writes the result with the browser's own JSON.stringify. It converts as you type. Choose 2 or 4 spaces or tabs for readable JSON, or Minified for the smallest output to paste into an API call or environment variable.

Because parsing happens in your browser, it is safe to paste Kubernetes manifests, CI pipelines, Docker Compose files or app configs that contain hostnames and internal settings. Nothing is sent to a server.

JSON is a subset of YAML 1.2, so any valid JSON is also valid YAML. The reverse is not true. Comments, anchors, multi-line strings and multiple documents have no JSON equivalent, so they are resolved or dropped during conversion.

YAML 1.2 surprises: yes, no, 0755 and version numbers

js-yaml 4 follows the YAML 1.2 core schema. Older YAML 1.1 parsers such as Python's PyYAML treat yes, no, on and off as booleans. In YAML 1.2 they are ordinary strings, and only true and false (also written True/TRUE and False/FALSE) are booleans: country: NO → {"country":"NO"}, enabled: yes → {"enabled":"yes"}, ok: True → {"ok":true}. This fixes the famous “Norway problem”, where the country code NO turned into false, but it means the same file can give different results in Python and JavaScript.

Leading zeros are not octal. In YAML 1.2 octal needs a 0o prefix: mode: 0755 → {"mode":755} but mode: 0o755 → {"mode":493}. In YAML 1.1, 0755 meant octal 493. File permissions and ZIP or PIN codes are where this bites.

Version numbers are floats. version: 3.10 → {"version":3.1}. The trailing zero is gone. Quote anything that only looks like a number: version: "3.10" → {"version":"3.10"}.

Dates become timestamps. js-yaml reads an unquoted date as a timestamp, which JSON writes in ISO format: released: 2026-10-20 → {"released":"2026-10-20T00:00:00.000Z"}. Quote it to keep the plain text.

Null has several spellings. a: ~ → {"a":null}, and an empty value such as b: is also null.

When you convert JSON back to YAML, strings that a YAML 1.1 parser would misread are quoted for safety. For example {"answer":"yes","zip":"012","n":12} becomes answer: 'yes', zip: '012', 'n': 12.

Error messages with line and column

When the YAML is invalid, the converter shows the problem, the line and column (counted from 1), and the surrounding lines with a marker under the exact spot. Click Go to line to jump there in the editor. For example, a mapping with the same key twice is rejected: “Line 3, column 1: duplicated mapping key”.

The most common errors are indentation that does not line up with the parent key, a tab used for indentation (YAML only allows spaces), a missing space after a colon (key:value is read as one string, not a key and value), and an unclosed quote or bracket. Values containing : or starting with *, &, !, % or @ need quotes, or they are read as something else or rejected.

Multiple documents, anchors and merge keys

A YAML file can hold several documents separated by ---, as Kubernetes manifests often do. A single JSON value cannot, so tick Multiple documents to get a JSON array with one item per document: name: web --- name: worker becomes [{"name":"web"},{"name":"worker"}]. Without the option you get a clear error telling you to tick it.

Anchors (&name), aliases (*name) and merge keys (<<) are expanded, because JSON has no references. Keys set directly in the mapping override merged ones: base: &base ⏎ retries: 2 ⏎ job: ⏎ <<: *base ⏎ retries: 5 becomes {"base":{"retries":2},"job":{"retries":5}}.

Tips for clean conversions

Quote values you need as strings: IDs with leading zeros, version numbers, phone numbers and anything like 1e3, which YAML reads as the number 1000.

Watch big integers. JavaScript numbers are exact only up to 253. The converter warns you when a larger integer would lose digits, and when .inf or .nan have to become null in JSON.

Validate before you commit. Pasting a config here is a quick way to catch indentation mistakes before a deploy fails. Need to search the result for a pattern? Try the regex tester. Documenting the config? Our Markdown to HTML converter turns your README into clean HTML.

YAML to JSON Converter: frequently asked questions

Is this YAML to JSON converter free and private?

Yes. It is free with no sign-up and no limits, and the conversion runs entirely in your browser using the js-yaml library. Your YAML is never uploaded, so it is safe for configs that contain internal hostnames or settings.

Why does "no" or "yes" stay a string instead of becoming false or true?

This converter uses js-yaml 4, which follows the YAML 1.2 core schema. In YAML 1.2 only true and false are booleans; yes, no, on and off are ordinary strings. Older YAML 1.1 parsers such as PyYAML turn them into booleans, so write true or false if you need a boolean everywhere.

How do I convert a YAML file with multiple documents?

Tick the Multiple documents option. Each document separated by --- becomes one item in a JSON array, in the same order. Without the option, a file with more than one document shows an error, because a single JSON value cannot hold several documents.

How do I find the error in my YAML?

The error message gives the line and column, counted from 1, and shows the surrounding lines with a marker under the problem. Click Go to line to jump there. Most errors come from inconsistent indentation, tabs used for indentation, a missing space after a colon, or an unclosed quote or bracket.

Are YAML comments kept in the JSON?

No. JSON has no comment syntax, so comments are dropped. Anchors and aliases are expanded into full copies and merge keys are resolved, because JSON has no references either.

How do I convert YAML to JSON on the command line?

With yq (version 4), run: yq -o=json file.yaml. With Python and PyYAML installed, run: python -c "import sys, json, yaml; print(json.dumps(yaml.safe_load(sys.stdin), indent=2))" < file.yaml. Note that PyYAML follows YAML 1.1, so values like yes and no become booleans there but stay strings in this converter.

Can I convert JSON back to YAML?

Yes. Choose JSON to YAML at the top of the tool, or open the separate JSON to YAML converter page. Your JSON is parsed and written as block-style YAML with 2 or 4 space indentation. Strings that older YAML parsers might misread, such as yes or 012, are quoted for safety.