YAMLTools logo
YAMLJSON

YAML to JSON Converter Online

Paste YAML and get valid JSON instantly — free, online and without signing up. The converter keeps your keys in the order you wrote them, turns multi-document YAML (---) into a JSON array, lets you pick 2 or 4 spaces, tabs or minified output, and tells you exactly what JSON could not keep: comments, anchors and aliases, merge keys, dates, .inf and .nan, custom tags like !Ref and integers too big for JavaScript. It runs entirely in your browser, so your Kubernetes manifests and Docker Compose files never leave your machine.

or paste your own below

YAML Converter - Convert Between Formats10 formats

Free YAML converter online. Convert YAML to JSON, XML, TOML, INI, Properties, CSV, and more. Also convert INI to YAML, TOML to YAML, and Properties to YAML. With automatic format detection.

Input (YAML)

YAML
Loading editor…

Output (JSON)

Result will appear here

When you'd convert YAML to JSON

Real-world scenarios where this conversion is the right move.

Feed configs to APIs and CLIs

Tools like AWS CloudFormation, Terraform or kubectl ultimately work with JSON internally. Convert your YAML before sending it to APIs that only accept JSON.

Inspect Kubernetes manifests

Some kubectl operations and admission controllers report errors against the JSON-flattened version of your manifest. Converting locally helps reproduce and debug those errors.

Diff between environments

JSON is more diff-friendly than YAML when comparing configurations across branches or environments — anchors and aliases get fully expanded.

Advertise here · Reach thousands of developers

YAML vs JSON — what changes

Quick reference for the structural differences between both formats.

AspectYAMLJSON
CommentsYAML supports # comments throughout.JSON has no comment syntax — comments are stripped on conversion.
Anchors and aliasesYAML lets you reuse values with & and *.JSON expands every reference into its full value.
Multi-documentYAML supports multiple documents separated by ---.JSON returns an array containing every document.
KeysKeys can be numbers, booleans or even lists (? [a, b]).Keys are always strings: 1: one becomes "1": "one".
Dates and special numbers2024-01-15, .inf and .nan are valid scalars.No date type and no Infinity/NaN: dates stay strings, .inf and .nan become null.
Trailing commasYAML uses indentation, no commas needed.JSON forbids trailing commas — the output is strict JSON.

Frequently asked questions

Is the YAML to JSON conversion lossless?

For the data, yes. What JSON cannot represent is listed under the output instead of being dropped silently: comments, anchors and aliases (expanded into full copies), merge keys (<<), non-string keys, dates, .inf/.nan, custom tags and integers above 2^53.

Does the converter keep the order of my keys?

Yes. The JSON is written from the parsed YAML tree, so keys come out in the order you wrote them — including numeric keys like "10" and "2", which a plain JavaScript object would reorder.

Can I choose the indentation or minify the JSON?

Yes. Pick 2 spaces, 4 spaces, tabs or minified output next to the result. The setting applies instantly.

Does it support Kubernetes YAML?

Yes. Kubernetes manifests convert cleanly to JSON. Files with several documents separated by --- become a JSON array with one item per document, and the converter tells you it did so.

Is my YAML uploaded to a server?

No. The conversion runs in your browser. Nothing is sent to our servers — you can verify it by opening the network tab in DevTools.

What if my YAML has errors?

You will get an inline error with the line and column of the issue. Use our YAML validator if you want detailed lint warnings and suggestions.

Other conversions

Hop into another conversion that shares one of these formats.