Skip to content
Webmaster Tools
JSON & dataYAML ↔ JSON

YAML to JSON Converter

Convert in either direction.

JSON

        

      
Runs in your browser

About the YAML to JSON Converter

This tool converts YAML to JSON and JSON to YAML in your browser. It uses js-yaml with the YAML 1.2 core schema, so yes and on stay strings, dates stay text, and custom tags like !!js/function are rejected instead of run. Merge keys (<<: *defaults) and anchors are expanded, and mapping keys keep the order they were written in, in both directions.

A file with several documents separated by ---, such as a Kubernetes manifest, becomes a JSON array with one item per document. Going back, tick Top-level array as separate documents to write each item as its own document again.

How to use it

  1. Choose YAML → JSON or JSON → YAML and paste your input, or click Load sample.
  2. Pick the indent: 2 or 4 spaces, or a tab for JSON.
  3. If the input is invalid, the error gives the line and column and shows the offending lines.
  4. Select Swap to use the output as the new input, and copy or download the result.

Examples

Common questions

Why are some values quoted in the YAML output?

Strings that another parser could read as a number, boolean or null, such as '1.0', 'yes' or 'no', are quoted so they stay strings in YAML 1.1 tools too.

Are comments kept?

No. JSON has no comments, so they are dropped when converting from YAML.

Is JSON valid YAML?

Almost always: YAML 1.2 is a superset of JSON, so you can paste JSON on the YAML side as well.