YAML to JSON converter

Turn YAML files into valid JSON.

Runs in your browser. Nothing you type is sent anywhere.

How to convert YAML to JSON

  1. Paste your YAML or upload a .yaml or .yml file.
  2. Fix any error at the line and column shown.
  3. Copy the JSON or download it.

Example: YAML in, JSON out

YAML lineJSON
name: Sam"name": "Sam"
age: 30"age": 30
active: true"active": true
tags: [a, b]"tags": ["a", "b"]

YAML features this keeps

  • Anchors (&name) and aliases (*name) are expanded into full copies of the referenced value.
  • Flow style, like inline {a: 1} or [1, 2], parses the same as the equivalent block style.
  • Several documents separated by a line of three dashes become one JSON array, in order.
  • Comments starting with # are dropped, since JSON has no comment syntax to carry them into.

Common YAML errors

SymptomLikely cause
Bad indentation errorA tab character, or a line indented one space off from the one above
Unexpected end of the streamA quote or bracket left open somewhere earlier
A value becomes true or false unexpectedlyBare yes, no, on or off written without quotes

Where YAML to JSON helps

  • Reading a Kubernetes manifest's exact values in a format your script already understands.
  • Debugging a CI pipeline file by seeing its parsed structure instead of raw indentation.
  • Feeding a YAML config into a tool or API that only accepts JSON.

YAML to JSON FAQ

What happens with several YAML documents in one file?

Documents separated by a line of three dashes are each converted and returned together as one JSON array, in order.

Why do I get a bad indentation error?

YAML reads structure from indentation, so a line indented one space too far, or a tab instead of spaces, breaks it. The error names the line and column, and Jump to error selects it.

Are anchors and aliases supported?

Yes. A value marked with an ampersand anchor and reused with an asterisk alias is copied into every place it is used.

What happens to dates?

Dates such as 2024-05-01 are kept as text, since JSON has no date type.

Can I paste YAML that uses tabs for indentation?

No. YAML requires spaces for indentation, so a tab produces a bad indentation error at the exact line. Replace it with 2 spaces and try again.

What happens to a duplicate key in a YAML map?

The last value written for a repeated key wins, since that is how the underlying parser resolves the map before turning it into JSON.

Can it convert a YAML file that includes another file?

No. Custom tags like !include, used by some YAML processors, depend on file system access this browser tool does not have. Plain YAML without custom tags converts normally.

Does it handle explicit type tags, like !!str or !!int?

Yes, common explicit tags are read and converted to the matching JSON type instead of being guessed from the value's shape.

Related tools