Developer tool

YAML to JSON Converter

Convert YAML to JSON and JSON to YAML in your browser with clear error messages, multi-document support, custom indent and optional key sorting.

Free, no sign-up. Runs in your browser; nothing is uploaded.

Options

Direction

YAML

JSON

How to use the yaml to json converter

Switch between YAML and JSON in one click

YAML is popular for configuration files such as Docker Compose, GitHub Actions, OpenAPI and Kubernetes manifests. JSON is what most code and APIs consume. This converter translates in both directions and tells you when something is wrong.

YAML to JSON

Paste YAML on the left. The JSON appears on the right, formatted with your choice of two or four space indentation. If the file contains several documents separated by three dashes, you get a JSON array with one element per document. Syntax problems are reported with a line and column so you can fix them quickly.

JSON to YAML

Paste JSON and the YAML appears with proper indentation. Turn on Sort keys to get alphabetical order, which helps when comparing two configs or keeping a file tidy in version control. Long lines are not wrapped, so values such as URLs remain on one line.

Common YAML traps

  1. Indentation uses spaces, never tabs. A tab is the most frequent cause of a parse error.
  2. Quote ambiguous values. Text like 1.10, 010, on or null may be read as a number or special value; quote it to keep it as a string.
  3. Colons in text. A value that contains a colon followed by a space needs quotes.
  4. Anchors and aliases (&name and *name) are expanded in the JSON output because JSON has no way to reference earlier values.
  5. Comments are lost. Keep your original YAML if the notes matter.

Using the output

Copy the result or download it as data.json or data.yaml. For Kubernetes or Compose, validate the converted structure with the tool that will read it, because this converter checks syntax, not the schema of any particular product.

Privacy

Nothing is uploaded. The YAML library runs inside your browser tab, so secrets in config files stay on your machine.

Frequently asked questions

Which YAML version is supported?

YAML 1.2 using the maintained yaml library, so anchors, aliases, multi-line strings and flow style are all understood.

What happens to comments?

JSON has no comments, so they are dropped when converting YAML to JSON. Converting JSON to YAML cannot recover them either.

Can it handle several documents in one file?

Yes. If the YAML has documents separated by ---, they are converted into a JSON array and a note tells you how many were found.

Why does a value like 010 or yes change type?

YAML guesses types from plain text. In YAML 1.2, yes and no are strings and only true and false are booleans. Quote values you want kept as text.

How are errors shown?

The parser reports the problem with a line and column, for example a tab used for indentation, which YAML does not allow.

Is anything sent to a server?

No. The conversion runs entirely in your browser.