Built on advanced on-device AI and hardware acceleration to deliver professional-grade performance with uncompromising privacy.On-device AI — professional-grade, fully private.
YAML to JSON Converter
YAML to JSON with manifests, merge keys and anchors handled
- Nothing uploaded
- Multi-document manifests
- Merge keys resolved
- Line and column errors
Drop a .yaml or .yml file
Or paste into the editor below. Up to 25.0 MB on the free plan.
YAML source
JSON output
How the JSON is spaced. Minified is one line with no whitespace.
What to do with a file holding several documents separated by ---.
Orders keys by code point so two conversions of the same data diff cleanly.
JSON cannot hold both values. Changing this re-reads the document.
JSON has no literal for either. Choose what happens to .nan, .inf and -.inf.
Dates stay exactly as typed unless you ask for ISO 8601.
Pro. Every document from every queued file, folded into a single JSON array.
Free converts one file up to 25.0 MB. Every output option is included.
How to convert YAML to JSON
- 1
Paste or drop your YAML
Paste into the editor, drag a .yaml or .yml file onto the drop area, or load one of the three samples. Conversion starts as you type — there is no button to press before you can see the result.
- 2
Choose the output shape
Pick 2 spaces, 4 spaces, tabs or minified. If the file holds several documents separated by ---, decide whether they become one JSON array, only the first document, or one file each. Turn on Sort keys when the output will be diffed.
- 3
Check what the conversion changed
The panel under the result names anything JSON cannot carry across: values like .nan and .inf, binary blobs written as base64, and tags such as !Ref that were resolved to the value underneath. Nothing is changed silently.
- 4
Convert, then download or copy
Press Convert to produce the files, then download the .json, copy it to the clipboard, or take a whole batch as one ZIP. If the YAML will not parse, the error names the line, the column and the text around it.
What this YAML to JSON converter offers
Paste YAML, drop a .yaml or .yml file, or load a sample, and the JSON appears as you type. Multi-document manifests, merge keys, anchors and unfamiliar tags are all handled rather than refused, and anything the conversion had to change is counted under the result instead of happening quietly. Choose 2 spaces, 4 spaces, tabs or minified output, sort the keys when the file will be diffed, then download the .json or copy it.
- YAML 1.2 core — Mappings, sequences, block and flow styles, multi-line scalars, anchors, aliases and merge keys. The scalar rules are the 1.2 core schema, so yes and no stay strings.
- Multi-document aware — A manifest separated by --- becomes a JSON array, its first document, or one file per document. The shipped version of this tool refused those files outright.
- Four output shapes — 2 spaces, 4 spaces, real tabs, or minified to a single line. Sort keys puts every object in a stable order so two conversions of the same data diff cleanly.
- Errors with a position — The message, the line, the column, and three lines of your own source with a caret under the fault — not a line number scraped out of a sentence.
- Nothing changed in silence — Non-finite numbers, binary blobs and resolved tags are counted and named under the result, because each of them is a value JSON cannot carry unchanged.
- Batch and ZIP — Queue up to 50 files on Pro, take them as one archive, or fold every document from every file into a single JSON array.
Multi-document YAML and Kubernetes manifests
A YAML file can hold several documents, separated by three hyphens on their own line. It is the normal shape of a Kubernetes manifest — a Namespace, a Deployment and a Service in one file — and it is also how kubectl, kustomize and helm template write their output. JSON has no equivalent separator, so a converter has to decide what to do, and refusing the file is the decision most of them make.
- Auto — One document converts to an object; several convert to an array of objects. This is what people expect, and it is the default.
- Array — Always an array, even for a single document. Use it when whatever reads the JSON iterates unconditionally and a bare object would break it.
- First document only — Takes the leading document and drops the rest. Useful when a manifest has been concatenated onto a file you only need the head of.
- Separate files — One .json per document, numbered and zero-padded so a directory listing sorts in the original order. Nothing else on this page's list of competitors offers it.
- Empty documents count — A stream of --- with nothing between the markers is a stream of null documents, and they are preserved rather than dropped, because their positions carry meaning in a patch.
Anchors, aliases and merge keys
YAML lets you name a node with &anchor and refer to it later with *alias, and lets a mapping absorb another one with the merge key <<. Between them they are how docker-compose files, GitLab CI pipelines and Helm values avoid repeating themselves. JSON has none of this, so every reference has to be expanded in place — and how a converter handles the merge key is the difference between a correct result and a plausible wrong one.
- Aliases are expanded — Each referenced node is written out wherever it is used. Two aliases to the same anchor produce two identical sub-trees in the JSON, because JSON cannot express that they were the same node.
- Merge keys are resolved — A service written as <<: *common comes out with the shared keys merged into it. A parser that follows YAML 1.2 to the letter leaves a literal "<<" key holding a nested object instead — valid JSON, wrong data, and no error.
- Later keys win — Keys written directly on the mapping override the ones it merged in, which is the behaviour docker-compose and GitLab CI rely on.
- Expansion is bounded — Anchors can be nested so that a tiny file expands to gigabytes. The possible expansion is measured before anything is parsed, and a file that could exceed the budget is refused in milliseconds rather than freezing the page.
How YAML types become JSON
The scalar rules are the YAML 1.2 core schema, and they differ from YAML 1.1 in ways that decide whether a value arrives as a string or a number. Getting this wrong is not a formatting difference — it changes the data.
- Booleans are true and false only — yes, no, on, off, y and n stay strings. Under YAML 1.1 they would become booleans, which is why a Norwegian country code of NO has broken so many pipelines.
- Numbers are decimal, octal and hex — 42, 0o14 and 0x1F are numbers. 1_000 is a string, because underscore separators are 1.1; so is 0b1010, for the same reason.
- Timestamps stay as written — 2001-12-14 is the string you typed, not a date shifted into your machine's timezone. Switch the timestamp setting to ISO 8601 if you want them normalised, and the count of what changed appears under the result.
- Block scalars keep their newlines — A | block keeps every line break; a > block folds them into spaces. Both arrive as ordinary JSON strings with the whitespace the YAML described.
- Tags resolve to the value underneath — !Ref, !GetAtt, !Sub and any other unfamiliar tag give you the scalar, sequence or mapping they were attached to, and the tag names are listed under the result.
Values JSON cannot represent
Some YAML has no JSON equivalent at all. Every converter has to do something about it, and almost all of them do it without telling you. The rule here is that nothing changes silently: each of these is counted, named, and where there is a real choice it is yours.
- .nan, .inf and -.inf — JSON has no literal for any of them. The default writes null and counts how many were converted; you can also have them written as strings, or have the conversion stop so you can decide in the source.
- Binary blobs — A !!binary node becomes a base64 string — the same text that was in the YAML, so nothing is lost, but it is a string now rather than bytes.
- Complex keys — A mapping or sequence used as a key has no JSON equivalent, so it is rendered as text. The key is preserved rather than being coerced into something like [object Object], which is what a naive conversion produces.
- Circular aliases — An anchor that refers to itself is legal YAML and impossible JSON. It is reported as a circular alias with the path to the node, instead of failing somewhere inside a serializer.
- Comments — YAML comments are not data and no JSON document can hold them. They are dropped, as they are by every converter — worth knowing if the comments were carrying the documentation for a config file.
Duplicate keys and other quiet data loss
The failures worth guarding against are not the ones that produce an error. They are the ones that produce a tidy, plausible, wrong document. A duplicate key is the clearest example: YAML permits you to write one, JSON has no way to hold both values, and so one of them disappears in the conversion.
- Refuse, by default — The conversion stops and names the line and column of the second key. That is the safe default, because the alternative is a file that looks converted and is missing a value.
- Or keep the last one — Switch the setting and the conversion completes with last-wins, which is what most YAML tooling does. The difference is that you chose it.
- The reverse is a tab — YAML forbids tabs for indentation. A file that looks perfectly aligned in an editor with tab stops set to two spaces will not parse, and the error names the line.
- Sort keys before you diff — Two exports of the same data can differ only in key order. Sorting makes the diff show the changes rather than the ordering.
A 25 MB manifest converts in a little over a second on the reference machine, and every part of it runs on your device.
Output options at a glance
- Indent — 2 spaces, 4 spaces, real tabs, or minified to one line. All four are free — there is no quality axis on an indent.
- Documents — Auto, always an array, the first document only, or one file per document.
- Sort keys — Orders every object's keys by code point, the same way in every language, so the output does not depend on your browser's locale.
- Duplicate keys — Refuse and report, or keep the last one. This setting is an argument to the parser, so changing it re-reads the document.
- Non-finite numbers — null, a string, or stop the conversion.
- Timestamps — Keep them exactly as written, or normalise to ISO 8601.
- Combine (Pro) — Every document from every queued file, folded into one JSON array in queue order.
Why convert YAML to JSON?
YAML is written by people and JSON is read by programs. The conversion is what lets a config that is comfortable to edit reach a system that only accepts JSON, and it is the fastest way to find out what a file actually says once the indentation has stopped being obvious.
- APIs take JSON — Turn a YAML config into a request body, a fixture, or a settings blob for a service that has no YAML parser.
- Debug the indentation — When a manifest is not behaving, converting it shows you the structure the parser saw, which is often not the structure the indentation suggested.
- Diff two configs — Convert both, sort the keys, and diff the JSON. Ordering and comment churn stop showing up as changes.
- Feed a JSON toolchain — jq, JSON Schema validators, and every JSON tool on this site work on the result.
- Runs on your device, not our servers — Manifests hold hostnames, image registries and occasionally a secret. The conversion happens in the page, so none of that is uploaded anywhere.
Frequently asked questions
How does the YAML to JSON converter work?
Paste your YAML or drop a .yaml or .yml file and the JSON appears as you type. Choose 2 spaces, 4 spaces, tabs or minified output, decide how multi-document files are folded, and press Convert to produce the downloadable file. Everything runs on your device: the document is never uploaded, and the converter keeps working after the page has loaded even with no connection.
Does it handle multi-document Kubernetes manifests?
Yes, and this is the reason most people arrive. A file whose documents are separated by --- on their own line is read as a stream. You choose what happens next: Auto gives a single object for a one-document file and a JSON array for a manifest, Array always wraps, First takes only the leading document, and Separate files writes one .json per document with a numbered name. Many converters simply refuse a multi-document file with a parse error.
Are anchors, aliases and merge keys supported?
All three. Anchors and aliases are expanded in place, because JSON has no reference syntax — each referenced node is written out wherever it is used. Merge keys are resolved too, so a docker-compose service written as <<: *common comes out with the shared keys merged into it rather than with a literal "<<" key holding a nested object. That literal-key result is a silent wrong answer, and it is what a strict YAML 1.2 parser produces unless merging is explicitly enabled.
What happens to .nan, .inf and other values JSON cannot represent?
You choose, and the converter tells you how many it found. JSON has no way to write NaN or Infinity, so most tools quietly emit null and say nothing. Here the default still writes null, but the panel under the result counts them; you can instead have them written as the strings "NaN", "Infinity" and "-Infinity", or have the conversion stop so you can fix the source.
How do YAML types map to JSON?
Mappings become objects and sequences become arrays. Scalars follow the YAML 1.2 core schema: true and false are booleans, ~ and null are null, plain integers and floats are numbers, and everything else is a string. That means yes, no, on and off stay strings rather than becoming booleans, and 1_000 stays a string because underscore separators are YAML 1.1 rather than 1.2. Multi-line block scalars keep their newlines exactly as written.
What does the converter do about duplicate keys?
By default it refuses the file and shows you the line and column of the second key, because a duplicate key is data loss: JSON has no way to hold both, so one of the two values disappears. If you would rather convert anyway, switch the duplicate-key setting to Keep the last one, which is what most YAML tooling does. Either way you are told the duplicate is there, which is the part other converters skip.
Does it work with CloudFormation, Helm or other tagged YAML?
CloudFormation templates convert. Tags such as !Ref, !GetAtt and !Sub are resolved to the scalar, sequence or mapping underneath them, and the tag names you used are listed under the result so nothing is lost quietly. Converters built on the common defaults throw an unknown tag error on all three. Helm templates containing {{ }} placeholders are not valid YAML until they have been rendered, so run helm template first.
What happens if my YAML is invalid?
You get the parser's message, the line and the column, and three lines of your own source with a caret under the exact position — not just a line number scraped out of an error string. Common causes are a tab used for indentation, an unclosed flow sequence, a missing closing quote and an alias whose anchor was never defined; each of those produces its own message. A link to the JSON to YAML tool is offered in case you had the conversion the wrong way round.
How large a file can it convert?
Free converts files up to 25 MB, one at a time. On the reference machine a 25 MB manifest parses and serialises in a little over a second, entirely off the interface thread, so the page stays responsive while it works. Pro raises the ceiling to what your device can handle, queues up to 50 files, downloads a batch as one ZIP, and can fold every document from every file into a single JSON array.
Is a YAML file with thousands of anchors safe to paste?
Yes. A short YAML file can be written so that its anchors expand into gigabytes — nine anchors of nine aliases each is a 324-byte paste that expands to roughly 387 million nodes. This converter measures the possible expansion before it parses anything and refuses the file in a couple of milliseconds. Tools that hand the text straight to a parser lock the tab for several seconds and then crash.
from 76 ratings
Rate this tool
Tap a star — it takes a second