YAML to JSON Converter.
Convert YAML to JSON in one click — multi-document streams, anchors and aliases, comments, and type inference, all handled. Private and instant, in your browser.
No signup · No uploads · No file-size cap
JSON output
Convert YAML to JSON online — free and private
A YAML to JSON converter turns human-friendly YAML configuration into JSON that APIs, tools, and code consume directly. Paste your YAML above, press Convert to JSON, and the parser produces correctly typed JSON. Because it runs client-side, you can convert YAML to JSON online without uploading config files or secrets.
How to convert YAML to JSON in three steps
- Paste your YAML into the input, or click “Load sample”.
- Pick output formatting — pretty-printed or minified JSON.
- Convert and export — copy the JSON or download it as
data.json.
Handles the YAML you actually write
Real YAML has features simple parsers miss, so this one covers
multi-document streams separated by ---,
anchors and aliases (&name /
*name), comment stripping, flow
collections, and literal or folded block scalars. Type inference turns
unquoted numbers and booleans into real JSON types while keeping quoted
strings as text.
Anchors are the feature naive converters get wrong. YAML lets you define
a block once and reuse it, which is common in docker-compose.yml
and GitLab CI:
defaults: &defaults
restart: always
logging:
driver: json-file
services:
web:
<<: *defaults
image: nginx:1.27
worker:
<<: *defaults
image: worker:2.1
JSON has no concept of a reference, so the anchor must be expanded — restart and logging are
inlined into both web and worker. That is what
this converter does; parsers that simply strip the & and * silently lose the shared values.
Convert YAML to JSON in Python, Node, or the terminal
Python (PyYAML) — always use safe_load, never load, which can execute arbitrary objects from untrusted YAML:
import json, yaml
with open("data.yaml") as f:
data = yaml.safe_load(f) # safe_load, not load
with open("data.json", "w") as f:
json.dump(data, f, indent=2) For a multi-document file, use safe_load_all:
docs = list(yaml.safe_load_all(open("manifests.yaml")))
json.dump(docs, open("manifests.json", "w"), indent=2) Command line (yq) — the one-liner most CI jobs want:
yq -o=json eval data.yaml > data.json
# every document in a multi-doc file:
yq -o=json eval-all '[.]' manifests.yaml > manifests.json Node.js (js-yaml):
import yaml from "js-yaml";
import { readFileSync } from "node:fs";
const data = yaml.load(readFileSync("data.yaml", "utf8"));
console.log(JSON.stringify(data, null, 2)); Common YAML to JSON problems (and fixes)
“Parse error and I cannot see why.” It is almost always a tab character. YAML bans tabs for indentation — spaces only. Turn on “show whitespace” in your editor and you will usually spot it immediately.
“My comments vanished.” Expected: JSON has no comment syntax, so there is nowhere to put them. Keep the YAML as your source of truth and treat the JSON as generated output.
“My multi-document file only converted the first manifest.”
Documents separated by --- become a JSON array, one
entry per document. If you only got the first, the tool you used ignored
the stream — this one does not.
“NO turned into false.” The Norway problem: YAML 1.1
treats yes, no, on, and off as booleans. Quote the value ("NO") in your
YAML to keep it a string.
“The JSON is hard to read.” Run it through the JSON formatter, explore it in the JSON viewer, or compare two configs with the JSON diff tool.
Why use this YAML to JSON tool?
It is fast, ad-free, and 100% private, with no file-size cap — which matters because the YAML you convert is usually a config file, and config files hold secrets, internal hostnames, and private registry credentials you should never paste into a server-side converter. Need the reverse? Use the JSON to YAML converter. Related: XML to JSON, CSV to JSON, JSON to TypeScript for typing a config, and JSON Schema generator to validate it. Learn more in our guide on how to convert YAML to JSON.
FAQ
YAML to JSON, answered.
How do I convert YAML to JSON online?+
Paste your YAML into the converter above and press Convert to JSON. The parser reads block maps, sequences, and scalars, infers types, and shows formatted JSON instantly. Copy it or download a .json file. Everything runs in your browser.
Does it support multi-document YAML?+
Yes. YAML streams separated by --- are parsed into an array of documents, so a file with several manifests converts cleanly. Single-document files convert to a single JSON value.
Are anchors, aliases, and comments handled?+
Yes. Comments (#) are stripped, and basic anchors (&name) and aliases (*name) are resolved so referenced values are inlined in the output. Quoted strings, flow collections ([] and {}), and literal/folded block scalars are supported too.
How are types inferred?+
Unquoted values that look like numbers, true/false, or null are converted to the matching JSON types, while quoted values stay strings. This produces clean, correctly typed JSON from typical config files.
Is it private?+
Completely. The conversion runs 100% client-side, so your YAML — including any secrets in a config file — is never uploaded or stored. There is no file-size cap.
What happens to my YAML comments?+
They are removed, because JSON has no syntax for comments — there is nowhere for them to go. This is the one thing you lose converting YAML to JSON, so keep the YAML file as your source of truth and treat the JSON as generated output.
Why does my YAML fail to parse?+
Nearly always indentation. YAML forbids tab characters for indentation — you must use spaces — and every sibling key must line up in the same column. Mixed tabs and spaces are the single most common cause of a YAML parse error, and the editor above reports the failing line.
How do I convert a Kubernetes YAML manifest to JSON?+
Paste it and convert. Multi-document files — several manifests separated by --- in one file — become a JSON array with one entry per document, which is exactly what most tooling expects. Since nothing is uploaded, it is safe for manifests containing secrets or internal hostnames.
Can I convert .yml files too?+
Yes. .yml and .yaml are the same format and this converter treats them identically. The extension is purely a naming convention — .yaml is the official recommendation, while .yml survives from the days of three-letter extensions.