YAML to JSON Converter

Paste YAML (Kubernetes manifests, Docker Compose, CI configs) and get clean JSON instantly. Errors show the exact line with a pointer.

Runs in your browserNo sign-upNothing uploaded

JSON output

How to use the YAML to JSON

  1. Paste YAML into the left box or open a .yaml/.yml file.
  2. JSON appears on the right as you type. Choose 2 spaces, 4 spaces or tabs for the output.
  3. Tick Sort keys to order keys alphabetically. This helps when comparing configs.
  4. If the YAML is invalid, the status bar shows the line and column, and the offending lines appear below it with a ^ marker.
  5. Copy or download the JSON, or press Swap to convert it back to YAML.

How YAML maps to JSON

JSON is a subset of YAML 1.2, so every YAML mapping becomes a JSON object, every sequence becomes an array, and scalars become strings, numbers, booleans or null. YAML-only features are resolved during conversion:

  • Comments (# …) are dropped, because JSON has no comments.
  • Anchors and aliases (&base, *base, <<: *base) are expanded into full copies.
  • Timestamps such as 2024-01-02 become ISO 8601 strings.
  • Multi-line strings (| literal and > folded blocks) become ordinary strings with \n escapes.

Multi-document YAML

A single file can hold several YAML documents separated by ---, as is common in Kubernetes manifests. JSON has no equivalent, so the converter returns a JSON array with one element per document and says so in the status bar. A lone trailing --- is ignored.

YAML 1.1 vs 1.2 gotchas

This converter follows YAML 1.2, the current spec. Many older tools (PyYAML, Ruby's Psych, some Kubernetes and Ansible versions) still read YAML 1.1, where the rules differ:

  • The Norway problem: in YAML 1.1, country: no means false, so Norway's country code NO disappears. The same goes for yes, on, off, y and n. YAML 1.2 only treats true and false as booleans.
  • Octal numbers: 0755 is octal in 1.1 but a plain decimal in 1.2, which uses 0o755. Quote file modes to be safe.
  • Sexagesimal numbers: in 1.1, 22:30 can parse as the number 1350. Quote times and port mappings such as "8080:80".

The JSON → YAML direction quotes ambiguous strings ('no', 'on', 'y') automatically, so the YAML it produces reads the same in both versions.

Frequently asked questions

Is my YAML uploaded anywhere?
No. Parsing happens in your browser with the open-source js-yaml library. Configs that contain secrets or internal hostnames never leave your machine.
Why does my YAML fail with “bad indentation”?
YAML nesting is defined by spaces, and tabs are not allowed for indentation. Make sure sibling keys line up exactly and list items (-) are indented consistently under their parent key.
What happens to YAML comments?
They are removed. JSON has no comment syntax, so comments cannot be carried over. Converting back to YAML will not restore them.
Why did <code>no</code> stay a string?
This tool follows YAML 1.2, where only true/false are booleans. Older YAML 1.1 parsers would turn no, yes, on and off into booleans (the “Norway problem”).
Can I convert a Kubernetes manifest with several resources?
Yes. Each ----separated resource becomes one element of the output JSON array, ready for jq or kubectl apply -f -, which accepts JSON lists too.

Related tools