YAML to JSON

Convert YAML documents to JSON.

0 chars
0 words
0 lines
0 chars
0 words
0 lines

YAML to JSON Converter Online

The YAML to JSON converter turns YAML documents into standard JSON. It is the quickest way to feed a YAML configuration — a Kubernetes manifest, an OpenAPI definition, a CI pipeline, a Hugo or Jekyll front-matter block — into tools and languages that only understand JSON, such as jq, JavaScript's JSON.parse, REST APIs, or JSON Schema validators.

How the conversion works

The input is parsed with a YAML 1.2 compliant parser and the resulting data is serialized with JSON.stringify. Every YAML construct maps onto JSON like this:

  • Mappings (key: value) → JSON objects, preserving key order.
  • Sequences (- item or [a, b]) → JSON arrays.
  • Scalars → strings, numbers, true/false, or null (~, null, or an empty value).
  • Block scalars (| and >) → strings with the newlines kept or folded exactly as YAML specifies.
  • Anchors & aliases → the referenced value is copied to every place it is used.
  • Multiple documents → a JSON array.

Output formatting

Pick 2 or 4 spaces, tabs, or Minified for the smallest possible payload — useful when you want to paste the JSON into an environment variable or a single-line request body.

Common pitfalls it exposes

Converting to JSON is also a good way to debug YAML. The Norway problem (NO meaning false) does not happen here because YAML 1.2 only treats true and false as booleans, but unquoted version numbers, times like 12:30, and octal-looking values are still worth checking. Seeing the typed JSON makes those mistakes obvious. Syntax errors are reported with the exact line and column.

Private

Conversion happens in your browser, so secrets in configs never leave your machine.

Need the opposite direction? Use JSON to YAML. To explore the result, open it in the JSON Viewer; for other formats try the YAML Converter or YAML to XML.

Frequently Asked Questions

The data is preserved: mappings become objects, sequences become arrays, and numbers, booleans, and nulls keep their types. What JSON cannot hold — comments, anchors, and the original formatting — is dropped; aliases are replaced by a full copy of the anchored value.

JSON has no date type, and the converter uses the YAML 1.2 core schema, which reads 2026-09-30 as plain text. You get exactly the characters you wrote, ready to be parsed by your application.

All documents are converted and wrapped in a JSON array, one element per document. A file with a single document produces that document directly.

In YAML an unquoted 1.10 is a number, and numerically 1.10 equals 1.1. If you mean a version string, quote it in the YAML ("1.10") and it will stay a string in the JSON.