YAML to JSON Converter
Paste YAML below to convert it to JSON, with every value the conversion silently changed listed underneath it.
- Free
- No account
- Runs in your browser
- Nothing uploaded
Runs entirely in your browser — your input is never uploaded, logged, or stored.Privacy policy
What is YAML to JSON Converter?
YAML is a configuration format built around indentation instead of brackets, which is why it carries Kubernetes manifests, CI pipelines, Docker Compose files and Ansible playbooks. JSON is the format the programs downstream actually read. Converting between them looks like a formatting change, and mostly it is: a YAML mapping becomes a JSON object, a sequence becomes an array, and the indentation becomes braces.
The part that catches people is that YAML has to decide what your unquoted text *means* before JSON can represent it. `01234` is not the string you typed, it is the number 1234 with the zero gone. `12:30` might be a time or might be the number 750, depending on which YAML version your parser implements. A date is a date in some parsers and a plain string in others. None of this is visible in the JSON that comes out — you just get a value that is subtly not what you wrote.
So this tool does two things. It converts, using the YAML 1.2 core schema, and then it lists every value where the conversion changed something or where another parser would disagree with it, with the line number. The JSON is the answer; the notices underneath are what stop you shipping a postcode of 1234 to production.
Parsing uses the `yaml` package (v2.9.0) with the YAML 1.2 core schema, then the parsed value goes through the browser's own JSON.stringify at your chosen indent. Merge keys are resolved, so `<<: *base` folds into the mapping rather than surviving as a literal `"<<"` key. A file containing several documents separated by `---` converts to a JSON array with one entry per document, which is what a Kubernetes manifest usually needs.
The notices come from walking the parsed document and comparing each plain (unquoted) scalar against the text you actually typed. That comparison is the whole point: `zip: 01234` produces the number 1234, and the only place the missing zero is still visible is the original source text. Quoted scalars are never flagged, because quoting is exactly how you tell YAML you meant a string — `zip: "01234"` converts to `"01234"` and generates no notice.
Nothing here is a guess about your intent. Each notice states what the value became, and where a version difference is involved, what the other version produces. The comparison figures below were produced by running the same input through PyYAML 6.0.3, not quoted from memory.
| YAML 1.2 core (this tool) | YAML 1.1 (PyYAML 6.0.3) | |
|---|---|---|
| deploy: no | "no" — a string | False — a boolean |
| start: 12:30 | "12:30" — a string | 750 — sexagesimal minutes |
| zip: 01234 | 1234 — leading zero dropped | 668 — read as octal |
| date: 2026-08-11 | "2026-08-11" — a string | A date object |
| on: push (as a key) | The key "on" | The key True |
Worked examples
- Input: name: Ada / active: true / tags: [math, cs] — converts to {"name": "Ada", "active": true, "tags": ["math", "cs"]}.
- A dropped leading zero: zip: 01234 converts to {"zip": 1234}. Quoting it as "01234" keeps the string intact, and the notice tells you which one you got.
- A YAML 1.1 disagreement: deploy: no converts to {"deploy": "no"} here, because YAML 1.2 removed yes/no/on/off from the boolean type. PyYAML returns False for the same line.
- Merge keys resolve: base: &b {region: eu, retries: 3} with prod: {<<: *b, retries: 5} converts prod to {"region": "eu", "retries": 5} — the override wins, and no "<<" key survives.
- Two documents separated by --- convert to a JSON array of two objects, so a Kubernetes manifest holding a Service and a Deployment comes out as [{...}, {...}].
- No JSON equivalent: nan: .nan and inf: .inf both convert to null, because JSON has no way to write either one.
- Beyond a double: id: 12345678901234567890 converts to {"id": 12345678901234567000} — the same limit the JSON formatter documents, reached here through YAML.
How to use YAML to JSON Converter
- Paste or type your YAML into the input box.
- Choose the output shape: 2 spaces, 4 spaces, or Minified for a single compact line.
- Read the JSON, then read the notices under it — they name every value the conversion changed.
- Copy the JSON. Nothing is uploaded, so closing the tab is all the cleanup there is.
Common errors
- "Tabs are not allowed as indentation" — YAML forbids tabs for indentation entirely, and an editor that inserts them silently is the usual cause. Replace the tab with spaces; the message gives you the line.
- "Map keys must be unique" — the same key appears twice in one mapping. YAML calls this an error rather than quietly keeping the last one, and so does this tool, because which of the two values you meant is not something anything can work out for you.
- "Unresolved alias" — a `*name` reference with no matching `&name` anchor before it. Anchors must be defined earlier in the document than the alias that uses them.
- "All mapping items must start at the same column", or "Nested mappings are not allowed in compact mappings" — one line sits at a different indentation from its siblings. YAML has no closing brackets, so the parser gives up at the first line whose indentation cannot be made to fit, which is often the line after the one you got wrong.
- "Implicit keys need to be on a single line" — usually a missing space after a colon. YAML needs `key: value`, not `key:value`; without the space the whole line is read as one long key with no value attached.
- "Missing closing quote", or "must be sufficiently indented and end with a ]" — an unterminated string, or a flow sequence or map opened with [ or { and never closed. The reported line is where the parser ran out of input, not where the opening character is.
- Everything converts but a value looks wrong — check the notices rather than the JSON. A postcode that arrived as 1234, or a version that arrived as 1.1, is a successful conversion of something you did not mean, not a parse failure.
- Your comments are gone — JSON has no comment syntax, so there is nowhere for them to go. This is a one-way conversion in that respect and no parser avoids it.
FAQ
Does this convert YAML to JSON in my browser, or is my file uploaded?
Entirely in your browser. The parser runs as JavaScript on the page you are looking at, so a config file with real hostnames or credentials in it never leaves your machine. Nothing is transmitted, logged or stored.
Why did my value 'no' stay a string instead of becoming false?
Because this tool implements YAML 1.2, which narrowed the boolean type to true and false only. YAML 1.1 also treated yes, no, on and off as booleans — the behaviour usually called the Norway problem, because the country code NO became false. PyYAML still does this: `deploy: no` gives False there and "no" here. Neither is a bug; they implement different versions of the spec. Quote the value and every parser agrees.
Why did my postcode or phone number lose its leading zero?
Because unquoted `01234` is a number to YAML, and 01234 and 1234 are the same number. The zero is not dropped by the conversion — it was never part of the value once YAML read it. Quote it (`"01234"`) to keep it a string. A YAML 1.1 parser makes this worse rather than better: it reads the leading zero as octal, so the same line gives 668.
Can it handle a multi-document YAML file with --- separators?
Yes. Each document becomes one entry in a JSON array, in file order, which is the shape you want for a Kubernetes manifest holding several resources. A single-document file converts to a plain object rather than a one-element array.
What happens to anchors and aliases when converting to JSON?
They are expanded. JSON has no way to express a reference, so `*base` becomes a full copy of whatever `&base` held, and a file using one anchor in five places produces five copies in the JSON. Merge keys (`<<: *base`) are resolved into the mapping rather than left as a literal "<<" key, with any key you set alongside the merge taking precedence.
Does this validate my YAML against a schema?
No — it checks that the YAML is well-formed and reports where it isn't, but it knows nothing about what your file is supposed to contain. A Kubernetes manifest missing its apiVersion is perfectly valid YAML, and this tool will convert it without complaint.
Can I convert JSON back to YAML here?
Not in this tool — it converts one way. Valid JSON is also valid YAML 1.2, so a JSON file pasted in here parses fine and comes back out as JSON, which is a formatting round trip rather than a conversion.
Why are my comments missing from the JSON?
JSON has no comment syntax, so there is nothing to convert them into. This is the one part of a YAML file that cannot survive the trip, which is worth knowing before converting a heavily-annotated config and treating the JSON as the new source of truth.
Is the JSON safe to paste straight into my code?
Yes. The output comes from the same JSON.stringify your own JavaScript would call, so it is valid JSON by construction, including the escaping of quotes, backslashes, newlines and non-ASCII characters inside strings.
Related tools
Prefer AllUtil on Google
One click adds AllUtil to your Google preferences. You'll see our tools highlighted with a Preferred badge in Search and AI answers.