Free Converter Tool

YAML to JSON Converter: Convert YAML to JSON and Back

Paste YAML and get clean, formatted JSON in one click, or switch direction and convert JSON to YAML. Syntax errors are flagged so you can fix them fast. Free, no signup.

YAML to JSON JSON to YAML Swap direction Error detection Pretty-printed output Copy & download No signup
YAML JSON

Convert YAML to JSON Without the Guesswork

Kubernetes manifests, GitHub Actions workflows, Docker Compose files and OpenAPI specs are all written in YAML, but plenty of tools, APIs and test runners only accept JSON. Paste your YAML here and the YAML to JSON converter gives you valid, indented JSON you can drop into a request body, a config loader or a test fixture.

Read more

Convert JSON to YAML in the Same Tool

Click Swap and the page becomes an online JSON to YAML converter. That’s handy when an API hands you JSON and you need it as a readable config file, Helm values or a CI pipeline step. The YAML output is cleanly indented, so it’s ready to commit.

Catch YAML Mistakes Before They Ship

A tab instead of spaces, a missing colon or one line indented a space too far is all it takes to break a YAML file. The converter flags invalid YAML, so you fix it here instead of finding out when kubectl or your CI runner throws an error.

What Changes During YAML to JSON Conversion

JSON is stricter than YAML, so a few things shift. Comments are dropped, because JSON has no comment syntax. Anchors and aliases (&default and *default) are expanded into full copies. Multi-line strings become single strings with \n line breaks. Your keys and values stay the same.

Watch Out for Sneaky YAML Values

Unquoted values can change type without warning. A version like 1.10 becomes the number 1.1, and a value with a leading zero like 0755 can come through as a number too. Under older YAML 1.1 rules, yes, no, on and off turn into true or false, which is how Norway’s country code NO famously became false. Quote anything that must stay a string.

An Online YAML to JSON Converter for Everyday Work

Use it to inspect a docker-compose.yml as JSON, feed YAML config into tools like jq that only read JSON, or turn an OpenAPI YAML spec into JSON for code generators. It runs in your browser, so you can convert files from any device without installing anything.

How to Convert YAML to JSON

1

Paste your YAML

Paste it into the input box, or click Sample to try an example first.
2

Pick the direction

YAML to JSON is the default. Click Swap if you want to convert JSON to YAML instead.
3

Click Convert

Valid input converts instantly. If there’s a syntax problem, you’ll see an error pointing to it.
4

Copy or download

Copy the output to your clipboard or download it as a .json or .yaml file.

YAML to JSON FAQs

Common questions about converting between YAML and JSON.

How do I convert YAML to JSON?

Paste it above and click Convert. In Python, json.dumps(yaml.safe_load(text), indent=2) does the same job with PyYAML. On the command line, yq -o=json file.yaml works with the Go version of yq.

How do I convert JSON to YAML?

Click Swap, paste your JSON and convert. In Python, yaml.safe_dump(json.loads(text), sort_keys=False) keeps your key order. With yq, run yq -p=json -o=yaml file.json.

Is YAML a superset of JSON?

Almost. YAML 1.2 was designed so that valid JSON is also valid YAML. That’s why going from JSON to YAML is lossless in practice, while YAML to JSON conversion can drop comments and expands anchors.

Why do I get an error when converting YAML?

The usual causes are tabs used for indentation (YAML only allows spaces), uneven indent levels, duplicate keys and unquoted values that contain ": " or " #". Wrap tricky values in quotes and try again.

Does the converter keep YAML comments?

No. JSON has no comment syntax, so comments can’t survive the trip. If you need them, keep the original YAML file as your source of truth and convert a copy.

YAML or JSON: which should I use?

JSON for APIs and data exchange, because it’s strict, fast to parse and supported everywhere. YAML for files people edit by hand, like configs and pipelines, because it allows comments and needs less punctuation.

Is this YAML to JSON converter online free?

Yes. It’s free, needs no signup and works on any device with a browser.

Is my data safe?

Conversion happens in your browser, so your YAML and JSON aren’t uploaded or stored. That makes it fine for config files, though it’s still smart to strip passwords and API keys first.

Converted? Check the Result.

Explore the output in JSON Viewer, or tidy it up with our JSON Formatter.

JSON Viewer

Raheel Jakhura

CEO / Co-Founder

Our goal is to provide online free tools so you don't have to install any software for basic usages. We are trying to add more tools and make these tools free forever.

cookies image
We care about your data and would love to use cookies to improve your experience.