consolelog.tools

YAML to JSON

Convert YAML to JSON live — supports multi-document YAML (--- → array), optional deep key sorting, and configurable indentation.

About this ToolHow it works, benefits & use cases

Paste YAML and get clean JSON back instantly. Built on the js-yaml parser, this converter understands the full YAML 1.1 syntax — nested mappings, block and flow sequences, quoted and unquoted scalars, anchors and the usual type tags. It is multi-document aware: when your input contains several documents separated by --- markers, they are collected into a JSON array so nothing is lost. You can choose 2- or 4-space indentation for the JSON output, and optionally sort keys deeply so that every nested object comes out in alphabetical order for stable diffs. Invalid YAML produces a clear error message rather than a crash, and the tool notes when multiple documents were merged into an array. The JSON streams live as you edit and can be copied, downloaded as a .json file, or shared via URL. Everything is parsed locally in your browser — your YAML is never uploaded.

How to Use

  1. 1Pick the JSON indentation you want, either 2 or 4 spaces.
  2. 2Toggle "Sort keys" if you want every nested object emitted in deep alphabetical order.
  3. 3Paste your YAML into the input panel — the JSON updates live — or click "Load example".
  4. 4Press "Convert to JSON" to validate the YAML; any syntax error is shown with a description.
  5. 5Copy the JSON, download it as output.json, or share it with the generated URL.

Key Benefits

  • Full YAML parsing via js-yaml — mappings, sequences, scalars and tags
  • Multi-document aware: --- separated documents become a JSON array
  • Optional deep alphabetical key sorting for stable, diff-friendly output
  • Selectable 2- or 4-space JSON indentation
  • Clear error messages on invalid YAML instead of failures
  • Live conversion with copy, .json download and shareable URLs
  • Parsed entirely in the browser — nothing is uploaded

Common Use Cases

  • Converting a Kubernetes or CI YAML manifest into JSON for tooling
  • Importing a YAML config into code that expects JSON
  • Merging a multi-document YAML file into a single JSON array
  • Normalising key order before committing or diffing converted output
  • Quickly inspecting deeply nested YAML by reading it as JSON

Options

Deep alphabetical key order

0 characters · live · multi-document aware

Paste YAML above to see the JSON live.

Was this tool helpful?

Share Your Experience

Help others discover this tool!

Related tools