YAML to JSON Converter

Convert YAML to JSON and JSON back to YAML in your browser. Handles anchors, ali...

SecureFastFree

Updated

Convert
Indent

YAML Input

JSON Output

YAML and JSON at a glance

Key and value
name: Ada
List
skills:
  - go
  - rust
Nested object
address:
  city: London
Types
active: true, age: 30, x: null

Quick answer

To convert YAML to JSON, paste your YAML into the input box and the tool parses it in your browser and shows the JSON instantly. It uses the js-yaml library, so anchors, aliases, multiline blocks, and typed values like numbers, booleans, and null are all handled correctly. Switch the direction toggle to turn JSON back into YAML, and choose 2 or 4 space indentation before you copy or download the result.

SSL Secured
256-bit Encryption
Cloud Processing
Mobile Friendly

Converter Features

Bidirectional - YAML to JSON and JSON to YAML
Anchors and Aliases - Resolved via js-yaml
Multi-Document - Emits a JSON array of docs
Custom Indent - 2 or 4 space output
Real Types - Numbers, booleans, and null
Copy or Download - Save a .json or .yaml file

Why Use YAML to JSON Converter?

Two-Way Conversion

Go YAML to JSON or JSON to YAML with one toggle. The output updates live as you type.

Real YAML Support

Powered by js-yaml, so anchors, aliases, multiline blocks, and typed values all convert correctly.

Pick Your Indent

Choose 2 or 4 space indentation for clean, readable JSON or YAML output every time.

100% Private

Every conversion runs in your browser. Your config never leaves your device or hits a server.

Common Use Cases for YAML and JSON

Docker Compose

Convert docker-compose.yml files to JSON for programmatic access and validation.

Kubernetes

Turn K8s manifests into JSON for API calls, or JSON responses back into readable YAML.

CI/CD Workflows

Parse GitHub Actions and pipeline YAML into JSON for analysis, or generate YAML from JSON.

App Configuration

Move config between YAML and JSON when a tool or API expects one format over the other.

How It Works

1

Paste Your YAML or JSON

Drop your YAML into the input box, or load the sample to see how the converter works.

2

Set Direction and Indent

Choose YAML to JSON or JSON to YAML, then pick 2 or 4 space indentation for the output.

3

Copy or Download

The output updates instantly. Copy it to your clipboard or download a .json or .yaml file.

Tips for YAML to JSON Conversion

Indentation Matters

YAML uses spaces, not tabs, for structure. Keep indentation consistent so the parser reads the nesting you intend.

Round-Trip With Swap

Use the Swap sides button to feed the output back as input, so you can convert YAML to JSON and straight back to YAML.

Quote Ambiguous Values

If you need a value like a version number or a leading-zero ID to stay a string, wrap it in quotes so it is not read as a number.

Frequently Asked Questions

Paste your YAML into the input box on the left. The tool parses it in your browser with the js-yaml library and shows the JSON on the right instantly. Pick 2 or 4 space indentation, then copy the JSON or download it as a .json file.
Yes. Click the JSON to YAML toggle and the tool reverses the direction, turning your JSON into clean YAML. Use Swap sides to send the current output back to the input so you can round-trip between the two formats.
Yes. Because the converter uses the js-yaml library rather than a hand-written parser, YAML anchors (&), aliases (*), merge keys (<<), and multiline blocks (| and >) are all resolved into the correct JSON structure.
Yes. A value like 30 becomes a JSON number, true and false become booleans, and null (or ~) becomes JSON null, so the output is not just strings. Note that js-yaml uses the YAML 1.2 core schema, so only true and false are booleans; words like yes and no stay as strings.
YAML files can hold several documents separated by ---. When your input has more than one document, the tool returns a JSON array with one entry per document, so nothing is dropped. A single document returns that document's value directly.
The tool shows a friendly error message instead of crashing. For invalid YAML it surfaces the line and column that js-yaml reports, so you can jump straight to the problem, fix the indentation or syntax, and watch the output reappear.
No. All parsing and conversion happen in your browser using JavaScript. Your YAML and JSON are never uploaded, which means the tool works offline and keeps sensitive config files on your own machine.

Related Tools