Skip to content
YAMLJSON

Free YAML to JSON Converter Online

Paste or upload YAML and valid JSON appears as you type. It’s free, needs no sign-up, and uploads nothing: the conversion runs entirely in your browser. When a document is broken, you get the exact line and column, a plain-English cause, and a suggested fix.

YAML

Paste your YAML here, or drop a file anywhere on the page

JSON

JSON appears here as you type

Free and unlimited · No sign-up · Nothing is ever uploaded · Updated

Key takeaways

  • Cost: free and unlimited — no account, no sign-up, and no file size cap beyond your device’s memory.
  • Privacy: the conversion runs in your browser, so nothing you paste is uploaded, and the page keeps working offline once it has loaded.
  • Versions: YAML 1.2 by default, with a warning on every value that YAML 1.1 would read differently.
  • What changes: comments are dropped because JSON has no syntax for them; anchors, aliases, and merge keys are expanded into full values.
  • Multi-document files: a --- separated stream becomes a JSON array or JSON Lines.
  • Errors: a failed parse reports the line and column, a plain-English cause, and a suggested fix.
  • Open source: the conversion core is MIT-licensed on GitHub, so you can read exactly what runs.

How does this YAML to JSON converter work?

Paste YAML into the input pane and the JSON appears in the output pane as you type — no convert button, no upload, no server round trip. Because yamltojsonfree ships the parser inside the page, the conversion is free, unlimited, and needs no account, with no file size cap beyond your own machine’s memory.

Shape the output however you need it: two spaces, four spaces, minified, keys sorted, and multi-document Kubernetes streams as a JSON array or JSON Lines.

The effort went into the failure path. A parse error gets a line and column, a marker in the editor, a plain-English explanation, and a concrete fix — unclosed brackets are reported as unclosed brackets, not as a misleading indentation complaint forty lines later. Every value whose meaning changes between YAML 1.1 and YAML 1.2 — the Norway problem and its relatives — is flagged with what each version would produce.

If your goal is tidier YAML rather than JSON, the YAML formatter reflows a document in place and keeps every comment. To go the other direction, the JSON to YAML converter is a click away. And when the conversion belongs in a script rather than a browser tab, the code and command line guide covers yq, Python, Node.js, and Go.

Why use this converter over the alternatives?

Most YAML converters are the same thin wrapper around a parser. These are the places where that shows.

Errors that name the actual problem

Most converters answer an unclosed bracket with “deficient indentation” and point at the wrong line. This one tells you which delimiter was never closed, where it opened, and how to fix it — with a marker on the line itself.

Warns you about YAML 1.1

country: no is the string “no” in YAML 1.2 and the boolean false in YAML 1.1. Every value in your document that changes meaning between versions is flagged, with the value each version produces.

Multi-document, properly

Kubernetes and Helm output is almost always --- separated. Convert it to a JSON array or to JSON Lines, with a count of the documents found.

Merge keys resolved

Docker Compose, GitLab CI, and Ansible lean on <<: *defaults. Merge keys are resolved by default, so you get the values you expect rather than a literal “<<” key.

Nothing leaves your browser

There’s no conversion endpoint to send data to. Open your network tab and watch, or pull the plug — the page keeps converting either way.

No account, no limit

No sign-up wall, no metered conversions, no “share to unlock”. Paste and go.

What is YAML?

YAML (“YAML Ain’t Markup Language”) is a data format designed to be written and read by people: indentation instead of brackets, comments, and reusable blocks. That’s why it became the default for configuration — Kubernetes, Docker Compose, GitHub Actions, and Ansible all use it.

The cost is ambiguity: whitespace is significant, and unquoted values can surprise you. The current specification, YAML 1.2.2, dates from October 2021 and makes no normative changes to the YAML 1.2 of 2009.

What is JSON?

JSON (JavaScript Object Notation) is a stricter, smaller format built for machines: braces, brackets, and always-quoted strings, with no comments and no ambiguity. It’s standardized as RFC 8259 and ECMA-404, and has exactly six kinds of value: strings, numbers, booleans, null, objects, and arrays.

That strictness is why you convert. Every language parses JSON the same way, so configuration turned into JSON behaves identically in an API, a test fixture, or a log pipeline.

“The YAML 1.2 specification was published in 2009. Its primary focus was making YAML a strict superset of JSON.”

— YAML 1.2.2 specification, section 1.2, “YAML History”

In practice, almost any JSON document is already valid YAML 1.2. The reverse isn’t true — indentation, comments, and unquoted strings are all foreign to a JSON parser — and that gap is what a converter closes.

YAML vs JSON at a glance

AspectYAMLJSON
CommentsYes, with #No
Structure fromIndentationBraces and brackets
ReuseAnchors, aliases, merge keysNone — values repeat
Quoting stringsUsually optionalAlways required
Typical useConfiguration written by peopleData exchanged by machines

YAML vs JSON by the numbers

  • 44% smaller: across seven example manifests from the Kubernetes documentation, the YAML takes 3,843 bytes and 194 lines. The same data as two-space JSON takes 6,902 bytes and 349 lines. We measured it on September 21, 2026, with comments removed so only the data is compared.
  • 22 booleans against 6: YAML 1.1 reads 22 spellings as true or false — y, Yes, NO, on, OFF and more. The YAML 1.2 core schema accepts six: true and false, each in three capitalizations.

YAML to JSON examples

Every example below converts correctly in the tool above. They cover the cases that most often surprise people.

Nested mappings and sequences

Indentation becomes nesting; a “-” list becomes a JSON array.

YAML

name: api
replicas: 3
ports:
  - 80
  - 443
resources:
  limits:
    memory: 512Mi

JSON

{
  "name": "api",
  "replicas": 3,
  "ports": [80, 443],
  "resources": {
    "limits": { "memory": "512Mi" }
  }
}

Anchors, aliases, and merge keys

JSON has no way to express a reference, so anchors are expanded in place.

YAML

defaults: &defaults
  restart: always
  logging: json

web:
  <<: *defaults
  image: nginx

worker:
  <<: *defaults
  image: redis

JSON

{
  "defaults": {
    "restart": "always",
    "logging": "json"
  },
  "web": {
    "restart": "always",
    "logging": "json",
    "image": "nginx"
  },
  "worker": {
    "restart": "always",
    "logging": "json",
    "image": "redis"
  }
}

Multiple documents

A --- separated stream becomes a JSON array — or JSON Lines, if you prefer one object per line.

YAML

apiVersion: v1
kind: Service
---
apiVersion: apps/v1
kind: Deployment

JSON

[
  { "apiVersion": "v1", "kind": "Service" },
  {
    "apiVersion": "apps/v1",
    "kind": "Deployment"
  }
]

Is this safe for private data?

Yes, and you don’t have to take our word for it. yamltojsonfree is a static page: there’s no server-side conversion endpoint, so there’s nothing for your YAML to be sent to. The parser is JavaScript that runs in your tab.

Two ways to verify it in under a minute. Open your browser’s developer tools, switch to the Network tab, and convert something — you’ll see no request carrying your data. Or load the page, disconnect from the internet, and keep converting; everything still works, because everything needed is already local.

This matters more than it sounds. Several popular converters offer a “load from URL” or “save and share” feature, which necessarily routes content through their servers, and at least one stores shared documents publicly by default. Configuration files are exactly the kind of thing that carries hostnames, internal paths, and the occasional secret.

Verdict: write YAML, ship JSON

YAML earns its place wherever a person edits the file — Kubernetes manifests, Compose files, CI workflows — because comments explain the values and anchors keep repetition down. JSON earns its place wherever a program reads it: API payloads, logs, fixtures, and anything generated at volume.

So author in YAML, know which version your tools actually parse, and convert at the boundary where people stop editing and programs take over. That last step is one paste here, and yamltojsonfree flags any value that would change meaning on the way.

Frequently asked questions

Is this YAML to JSON converter free?

Yes, completely. There’s no sign-up, no account, no usage limit, and no paywall. Every feature on this page is available to everyone, every time.

Is my data uploaded to a server?

No. The conversion runs in your browser using JavaScript. Your YAML is never transmitted anywhere — there’s no server-side conversion endpoint, no logging, and no analytics on the content you paste. You can confirm this by opening your browser’s network tab while converting, or by disconnecting from the internet: the page keeps working.

Do I need to install anything to convert YAML to JSON?

No. It runs in the browser tab you already have open, with no download, no command line tool, and no extension to install. Every online converter has to decide where the conversion actually happens — most send your document to their server, this one keeps it on your machine. If you would rather script the conversion, the guide Convert YAML to JSON in code covers the command line, Python, Node.js, and Go.

Is there a file size limit?

There’s no artificial cap. Conversion happens on your own machine, so the practical limit is your device’s memory. Files of a few megabytes convert without trouble; very large documents may briefly pause the page while parsing.

Can I convert JSON back to YAML?

Yes. Use the swap button between the two panes to reverse the direction without leaving the page, or go to the dedicated JSON to YAML converter. Swapping carries the current output across as the new input, so you can round-trip a document.

What happens to my YAML comments?

They’re dropped, because JSON has no syntax for comments. The converter tells you how many were removed rather than discarding them silently. If you need to keep comments, use the YAML Formatter, which reformats YAML in place and preserves them.

How does the converter handle multi-document YAML?

Files that separate documents with --- are fully supported. You can output them as a JSON array containing every document, or as JSON Lines (NDJSON) with one compact JSON object per line, which is the format kubectl and most log pipelines expect. Kubernetes manifests and Helm output are typically multi-document.

Are anchors, aliases, and merge keys supported?

Yes. Anchors (&name) and aliases (*name) are expanded into their full values, since JSON has no way to express a reference. Merge keys (<<) are resolved by default, which is what Docker Compose, GitLab CI, and Ansible files rely on. You can turn merge resolution off if you want to see the raw << key instead.

What is the difference between YAML 1.1 and YAML 1.2?

YAML 1.2 treats unquoted values like no, yes, on, and off as plain strings. YAML 1.1 treats them as booleans — so country: no becomes false. YAML 1.1 also reads 022 as octal 18 and 12:30 as the base-60 number 750. This converter defaults to YAML 1.2 and warns you whenever a value in your document would be read differently under 1.1.

Why does my YAML fail with an indentation error?

The two most common causes are a tab character used for indentation, which YAML forbids entirely, and an unquoted value containing a colon, such as title: foo: bar. Unclosed brackets and quotes also surface as indentation errors in most parsers; this converter detects them specifically and points at the delimiter that was never closed.

Does the converter validate my YAML?

Yes. If the document can’t be parsed you get a plain-English description of the problem, the exact line and column, a suggested fix, and a marker on the offending line in the editor. The dedicated YAML Validator page is the same engine with the output pane focused on diagnostics.

Can I convert YAML to JSON from the command line?

Yes. yq -o=json input.yaml is the quickest option. In Python, use json.dumps(yaml.safe_load(open("input.yaml"))). In Node.js, use js-yaml. Full examples for Python, Node.js, Go, and the command line are in the guide Convert YAML to JSON in code.

Does the page work offline?

Once it has loaded, yes. Everything needed to convert is already in your browser, so the tool continues to work if you lose your connection.

Converting YAML to JSON

How do I convert YAML to JSON?

Paste your YAML into the input pane of the converter at the top of this page — it converts in your browser as you type, so there’s no convert button to press and nothing is uploaded. Set the indentation to 2 spaces, 4 spaces, tabs, or minified, optionally sort the keys, then copy the JSON or download it as a .json file. If the document doesn’t parse you get the exact line and column, a plain-English explanation, and a suggested fix rather than an empty output pane. For a conversion you need to repeat, yq -o=json input.yaml does the same job from a terminal.

How do I convert a YAML file to a JSON file?

Press Upload to pick a .yaml or .yml file, or drag it anywhere onto this page, then press Download to save the result as a .json file. The file is read by your browser and never sent anywhere, which matters for configuration that carries hostnames, registries, or credentials. To convert a YAML file into a JSON file from a shell, use yq -o=json input.yaml > output.json, or convert a whole directory at once with: for f in *.yaml; do yq -o=json "$f" > "${f%.yaml}.json"; done

Can YAML be converted to JSON?

Yes, in almost every case. YAML 1.2 is defined as a superset of JSON, and any YAML document built from ordinary mappings, sequences, strings, numbers, booleans, and nulls has an exact JSON equivalent. Four things don’t survive the trip: comments, because JSON has no syntax for them; anchors and aliases, which are expanded into their full values since JSON can’t express a reference; mapping keys that aren’t strings, such as dates or nested structures, which JSON doesn’t allow; and custom tags such as !Ref or !GetAtt, which have no meaning outside their own tooling. This converter reports each of those instead of dropping them silently.

Is YAML valid JSON?

It works the other way around: JSON is valid YAML, but YAML is generally not valid JSON. The YAML 1.2 specification defines the language as a superset of JSON, so any JSON document can be handed to a 1.2 parser unchanged — you can paste JSON into the input pane above and it will parse. A YAML document only happens to be valid JSON if it’s written in JSON’s own flow style with every key and string quoted and no comments; ordinary indentation-based documents are rejected by every JSON parser. Note that the guarantee applies to version 1.2 only — 1.1, which PyYAML and older tooling implement, isn’t a strict superset of JSON.

How can I convert a YAML array to JSON?

A YAML sequence — the block of lines each beginning with a dash — becomes a JSON array with no extra steps, so ports: followed by - 80 and - 443 converts to "ports": [80, 443]. Two cases surprise people. A document whose top level is a sequence converts to a bare JSON array rather than an object, which is valid JSON and handled here. And a multi-document stream separated by --- isn’t a single array: pick the JSON array output option to wrap every document in one, or JSON Lines to get one compact object per line, which is what kubectl and most log pipelines expect.

YAML vs JSON

What is the difference between YAML and JSON?

JSON is a strict interchange format for machines; YAML is a configuration format for people that can express the same data. Concretely: YAML takes its structure from indentation while JSON uses braces and brackets; it supports comments with # where JSON has none at all; it can reuse blocks through anchors, aliases, and merge keys while JSON repeats every value in full; it can hold several documents in one file separated by ---, where JSON holds exactly one value; and it usually lets you leave strings unquoted, which is convenient until country: NO is read as false. Because YAML 1.2 is a superset of JSON, anything JSON can express, YAML can express too.

When should I use YAML vs JSON?

Use YAML when a person writes and maintains the file, and JSON when a machine writes or reads it. YAML pays for itself in configuration that gets read in code review — Kubernetes manifests, Docker Compose, GitHub Actions workflows, Ansible playbooks, OpenAPI specifications — because comments can explain the values and anchors keep repetition down. JSON pays for itself in API request and response bodies, log lines, test fixtures, and anything generated or stored at volume: it parses faster, every language ships a parser, there’s no significant whitespace to get wrong, and no version ambiguity to argue about. When both arguments apply, the usual answer is to author in YAML and convert to JSON at build time, which is what the converter at the top of this page is for.

How does YAML compare to JSON for readability and usability?

YAML is easier to read and harder to get right; JSON is noisier and far more predictable. On readability YAML wins clearly for nested configuration: no closing brackets, no quotes around every key, no commas to misplace, and comments to explain the values that aren’t obvious — the same Kubernetes manifest is roughly 40% shorter in YAML than in JSON. On usability the trade reverses. Indentation is significant, so a stray tab or a misaligned sibling key breaks the document; unquoted values can silently change type (yes, no, on, off, 022, 12:30); duplicate keys and the split between YAML 1.1 and 1.2 produce files that parse cleanly and still behave wrongly; and YAML parser errors are notoriously vague about where the real problem is. JSON has none of those failure modes, which is why the practical position is to write YAML and validate or convert it before it ships.

Sources

Every figure and quotation on this page, and where to check it.

  • YAML 1.2.2 specification (2021) — the history quoted above, and the six core-schema booleans in section 10.3.2
  • YAML 1.1 boolean type (2005) — the 22 spellings YAML 1.1 reads as booleans
  • RFC 8259 (2017) — the JSON standard and its six kinds of value
  • ECMA-404 — the same syntax, standardized by Ecma International
  • Kubernetes documentation examples — the seven manifests measured above: controllers/nginx-deployment.yaml, controllers/job.yaml, application/deployment.yaml, application/guestbook/redis-leader-deployment.yaml, application/wordpress/mysql-deployment.yaml, pods/pod-with-node-affinity.yaml, service/networking/nginx-svc.yaml
  • js-yaml — the YAML parser underneath the converter
  • yaml-to-json-core — the MIT-licensed conversion core behind yamltojsonfree