Skip to content
toolavix

YAML to JSON Converter

Convert YAML to formatted JSON and see syntax errors with their line number.

  • Free
  • No sign-up
  • 100% private

Runs in your browser — your files never leave your device.

How do you convert YAML to JSON?

Converting YAML to JSON means parsing the indentation-based YAML structure and writing the same data with braces, brackets and quoted keys. This YAML to JSON converter reads YAML 1.2 documents including lists, nested maps, anchors, multi-line strings and typed scalars, outputs formatted JSON with 2 or 4 spaces, and reports syntax errors with line and column. Everything is processed in your browser.

How to convert YAML to JSON

  1. 1

    Paste your YAML or YML into the input box, or press “Try an example”.

  2. 2

    Fix the indentation or syntax if an error with a line number appears.

  3. 3

    Choose 2 or 4 spaces for the JSON output.

  4. 4

    Copy the JSON or download it as a .json file.

Key features

Full YAML support

Block and flow collections, anchors and aliases, multi-line strings, comments and typed scalars are all understood.

Error location

Indentation mistakes and invalid syntax are reported with line and column so you can fix them quickly.

Formatted JSON

Get pretty-printed JSON with your choice of indentation, ready for APIs and tests.

Private

The YAML never leaves your browser, which matters for configuration files that contain internal names and settings.

Frequently asked questions

What happens to comments in YAML?

JSON does not support comments, so they are dropped during conversion.

How are YAML anchors converted?

Anchors (&name) and aliases (*name) are resolved, so the referenced value is written out in full everywhere it is used.

Why did my YAML value become a number or boolean?

YAML infers types: 123 is a number, true is a boolean and null is null. Put the value in quotes in the YAML to keep it as a string.

Does it support multiple YAML documents?

This tool converts a single document. If your file contains several documents separated by ---, convert them one at a time.

Is YAML or JSON better for configuration?

YAML is easier to read and supports comments, while JSON is stricter and faster to parse. Many tools accept both.

More Developer tools

View all →