YAML to JSON Converter

Paste either format and get the other. The direction is detected from the input, key order is preserved, and it tells you what the conversion cost you, because converting between these two is never quite lossless.

Paste below, or drop a file anywhere on this panel

Or drop a file anywhere on this panel. Nothing is uploaded: the analysis runs in this tab.

The answer appears here

Paste on the left and press Convert. Nothing leaves this tab.

Examples

Real input you can load into the tool above. Each one shows a different thing going wrong, because that is what the tool is for.

A tab in the indentation

YAML forbids tabs for indentation, and the error is usually reported far from the tab

name: api
ports:
	- 80

A clean document

Structure converted both ways, with types preserved

name: api
replicas: 3
ports:
  - 80

Common mistakes

These are the ones that fail silently. The config is accepted, nothing raises an error, and the consequence arrives later.

  1. Expecting YAML comments to survive

    JSON has no comments, so a round trip through JSON deletes every one of them silently.

    Instead:Convert one way only, or keep the YAML as the source of truth.

  2. Assuming key order is preserved

    JSON objects are unordered by specification, and some converters sort keys.

    Instead:Use an array if order matters.

  3. Converting a large integer

    Numbers beyond 2^53 lose precision in JSON. An ID written as a bare number can come back changed.

    Instead:Quote large integers so they stay strings.

What it does

The conversion is the easy part. What matters is what does not survive it.

Direction detected automatically

No mode switch to get wrong. Input starting with a brace or bracket is treated as JSON, anything else as YAML, and the verdict says which way it went.

Comments cannot survive

JSON has no comment syntax, so going YAML to JSON drops every comment. This is not a limitation of the tool, it is the format. Keep the YAML as the source of truth and treat the JSON as generated.

Anchors are expanded, not preserved

YAML anchors and aliases let a document reuse a block. JSON has no equivalent, so each reference is written out in full. The output is correct, larger, and editing one copy no longer changes the others.

Type traps on the way back

Going JSON to YAML, any string that reads as a boolean or null in YAML gets quoted so it round-trips. The output is safe; the risk is somebody removing those quotes later, which is why they are flagged.