Skip to content
{}

YAML to JSON Converter

Convert YAML, including multi-document files and merge keys, to JSON. Values JSON cannot hold are reported by path, never rewritten.

0 chars | 1 lines
0 chars | 0 lines

Conversion payloads stay in this browser tab and are never placed in page URLs - see how local processing works. Privacy-safe analytics record only the tool, outcome, and a coarse input-size bucket.

How to Convert YAML to JSON

Paste YAML or open a .yaml or .yml file, and the JSON appears as you type. Copy it or download it as a .json file. If the YAML does not parse, the error gives the line and column; if it parses but contains a value JSON cannot hold, the error gives the path to that value instead of producing quietly altered output.

What Changes Between YAML and JSON

Comments are dropped, because JSON has none. Anchors and aliases are expanded into copies, so a value referenced three times appears three times. Unquoted dates such as 2024-01-02 stay strings under YAML 1.2. Keys that are not strings, like 1: or true:, become JSON string keys. Run the YAML validator first if you want duplicate-key and unresolved-tag warnings listed before you convert.

What is YAML?

YAML (YAML Ain't Markup Language) is a human-readable data serialization format. It's commonly used for configuration files, especially in DevOps tools like Docker Compose, Kubernetes, and Ansible. YAML uses indentation to represent structure, making it very readable but sometimes tricky to edit correctly.

What is JSON?

JSON (JavaScript Object Notation) is a lightweight data interchange format. It's easy for humans to read and write, and easy for machines to parse and generate. JSON is the standard format for APIs and is supported by virtually every programming language.

Common Use Cases

Developers often convert YAML to JSON when working with APIs that only accept JSON, when debugging configuration files, when feeding a Kubernetes manifest or GitHub Actions workflow to a JSON-only tool such as jq, or when migrating from YAML-based configs to JSON-based systems.

Convert YAML to JSON in Code

For scripts and CI pipelines, convert on the command line or in code:

yq (CLI)

yq -o=json config.yaml

Python

import yaml, json
with open("config.yaml") as f:
    print(json.dumps(yaml.safe_load(f), indent=2))

Node.js

const yaml = require("yaml");
const json = JSON.stringify(yaml.parse(fs.readFileSync("config.yaml", "utf8")), null, 2);

Frequently Asked Questions

Is my YAML data secure when using this converter?

Yes, absolutely. All conversions happen directly in your browser using JavaScript. No data is ever sent to our servers or any third-party services.

What YAML features are supported?

YAML 1.2: nested mappings and sequences, block and flow styles, multi-line strings, anchors and aliases, and merge keys (<<: *defaults), which are applied so the JSON contains the merged values. A %YAML 1.1 directive switches to 1.1 rules, where yes and no are booleans.

Can I convert a file with several YAML documents?

Yes. A file with documents separated by --- - such as several Kubernetes manifests in one file - becomes a JSON array with one element per document, in order. A lone --- at the start or end of the file does not add an empty document.

Why does the converter refuse .inf or .nan?

JSON has no Infinity or NaN. Most converters quietly write null instead, which changes the value. This one stops and names the path, so you can quote the value as a string or replace it.

What happens to big integers and custom tags?

Integers beyond 2^53, such as 64-bit IDs, are written to the JSON exactly rather than rounded, with a note that JavaScript's JSON.parse will round them. Custom tags such as CloudFormation's !Ref have no JSON equivalent; the tagged value is kept as plain data and the conversion notes list which tags were dropped.

Can I convert large YAML files?

Yes. Above 1 MB, automatic conversion pauses so typing stays responsive; press Convert when you are ready. Very large files are limited by the memory of the browser tab, not by an upload limit.

Configuration workflow

Continue with the data, not the directory

Move between JSON, YAML, and TOML while keeping format semantics visible.

Browse configuration formats