Free online tool

YAML to JSON Converter

Paste YAML on the left and copy formatted JSON from the right. It is free, it runs in your browser, and it does not ask you to sign up.

Also works as a quick JSON to YAML path when you flip the direction—still free, still in-browser.

No uploadYAML → JSON runs in this tab. Documents split by --- become a JSON array. Errors include a line and column when the parser reports one. Nothing you paste is uploaded.

When to convert YAML to JSON

YAML is common in Kubernetes manifests, CI configs, Docker Compose, and app settings. Many APIs, front-end fixtures, and log pipelines expect JSON. A free online YAML to JSON converter lets you paste a snippet, check the structure, and copy JSON without installing a CLI — useful when you only need a one-off conversion.

That one-off case shows up constantly. A manifest goes into a ticket so someone without kubectl can read the data. A Compose file has to become JSON before a script that only calls JSON.parse. A values file is compared with the shape a chart expects. A workflow snippet is dropped into a browser fixture. In each of those moments the source of truth can stay YAML. The JSON is a view of it, produced for the tool that asked.

A local CLI is still the right habit when the same conversion runs on every commit. This page does not replace yq, a short Python or Node script, or a build step you can pin. It covers the gap before that: the text is already in a buffer, you want formatted JSON now, and you do not want to create a project just to see the result. Used as a yaml to json online step, the snippet is parsed in the tab. It is not posted anywhere for conversion.

The same editor helps when a service dumped JSON and a person now has to maintain it. Configs that started as JSON are often easier to review once they are YAML, especially in a pull request. Flip the direction, paste, and read. The section on JSON to YAML below is that path. Diffing is another quiet use: convert two YAML files to JSON and compare the JSON, so comments and indentation stop looking like real changes.

This is a converter, not a cluster client and not a schema checker. It will not apply a file, call an API, or decide whether a manifest is valid Kubernetes. It checks that the text parses, and that each value can live in JSON. That narrower job is why it can stay free, in the browser, with no account.

How this YAML to JSON online tool works

  1. Paste YAML on the left (or load a small example).
  2. Valid input becomes pretty-printed JSON on the right as you type.
  3. Copy or download the result.

Conversion runs locally in the tab. This page is a browser YAML parser plus formatter-style JSON output — not a server upload form. The parser is the yaml package, running as JavaScript on your device. Nothing in the text areas is sent off for conversion. Sample fills the current direction with a short built-in document. Clear empties the input. There is no submit button: a valid edit updates the other side immediately.

The two controls above the editors pick the direction. YAML to JSON is the default. JSON to YAML uses the same boxes, with JSON on the left and YAML on the right. Switching keeps a valid result as the next input, so you can turn a document around and see what survives. One limit matters: comments that JSON dropped do not come back.

Output JSON is indented with two spaces. That is the formatter-style part. The tool does not rewrite your original YAML, and it is not a general YAML formatter that prints YAML back with a house style. If you need YAML again, switch direction. If you need the JSON for an API body or a fixture, copy it, or download converted.json. In the other direction the file is converted.yaml. Copy and Download stay off while the input is empty or invalid, so a broken parse is not written to the clipboard by accident.

Empty input produces empty output and no error. The first problem in an invalid document is shown above the editors. When the parser reports a location, that note includes the line and column, for example “at line 3, column 1”. Fix that line and convert again. The steps, and a few extra rules about quotes and numbers, are also on the how to convert YAML to JSON page.

YAML vs JSON (what you should expect)

YAML and JSON can describe the same trees of maps, lists, strings, numbers, booleans, and null. They are not the same syntax. JSON is stricter. A conversion is a translation, and a few YAML features have nowhere to go. Expect the following.

  • Comments (# ...) do not exist in JSON, so they are dropped.
  • Anchors and aliases are expanded into concrete values.
  • Merge keys (<<) are applied.
  • Multi-document YAML (--- separators) becomes a JSON array.
  • Numbers and booleans follow YAML rules unless you quote them as strings.

A comment beside a key is for readers of the YAML. It will not appear in the JSON, and it will not reappear if you convert that JSON back to YAML. If a note must survive, put it in a real string field before you convert.

Anchors are resolved the way most applications resolve YAML before they use it. An alias (*) is written out in full, so the JSON contains the data, repeated, rather than a pointer. A circular alias has no finite JSON value. The converter rejects it instead of looping. Very large alias graphs are also refused, so a hostile snippet cannot expand without limit inside the tab.

Merge keys are applied before the JSON is built. Keys from the merged map are copied into the result, and the << key itself is not left behind. A later key in the same map overrides a key that arrived through the merge. That is the usual YAML rule, and it is the one this parser follows.

Multi-document input is the case people miss. One document stays a single JSON value. Two or more documents, split by ---, become an array with one element per document, in order. An empty document in that stream becomes null. A normal config is not wrapped in an array just because YAML files sometimes start with---. The array appears when the stream actually contains more than one document. That shape matches Kubernetes-style files that stack several resources in one buffer: each resource is one element, and you can see the boundaries that indentation alone hides.

Numbers and booleans follow YAML 1.2 unless you quote them. true, false, null, ~, and numeric literals become JSON booleans, null, and numbers. True and FALSE are booleans too. yes, no, on, and off stay strings. This tool does not use the older YAML 1.1 reading that treated those four words as booleans. Quote a value when the characters themselves matter.

A few YAML types are refused because JSON cannot store them honestly. NaN and Infinity are errors. An integer outside the range a JSON number can keep exactly is an error, with a note to quote it if you need every digit. Explicit binary data is rejected rather than turned into a list of byte numbers. Explicit !!timestamp values become ISO 8601 strings. A plain date such as 2024-01-02 stays a string.

JSON to YAML on the same page

Need the reverse direction? Switch to JSON to YAML on this converter. Paste JSON, get readable YAML for configs or docs. Keep one URL for both directions so the work stays on one page: yaml to json, json to yaml, and convert yaml to json are the same editor with the direction flipped.

The YAML you get is block style, which is the form most people want for manifests and settings. Objects and arrays in the JSON become nested blocks rather than a single long line. There is no comment channel in JSON, so the YAML has no comments to recover. Keys stay strings. Pretty-printed or minified JSON both parse. Whitespace in the input does not change the data.

Invalid JSON does not produce a partial document. The notice above the editors quotes the parser. When that message includes a line and column, start there. Trailing commas, single quotes, and bare keys are the usual misses when YAML-ish text is pasted into the JSON side by accident. Switch back to YAML to JSON if the text is actually YAML.

Use JSON to YAML when a service dumped JSON and you want something you can edit with less punctuation, or when a doc will be easier to scan as YAML. Download saves converted.yaml in that mode and converted.json in the other. Either way the file is built in the tab. It is not uploaded.

Common errors and how to fix them

  • Tabs for indentation: use spaces.
  • Misaligned list items under a key.
  • Unquoted values that look like numbers (1.10 becomes 1.1, 0123 becomes 123). Quote them to keep strings.
  • Broken quotes or flow collections.

Tabs are rejected. YAML indentation is spaces. A tab that sneaks in from a snippet, or from an editor set to hard tabs, fails the parse, and the message points at the line. Replace the tab with spaces and keep each level aligned with its parent. Two spaces per level is enough, and it matches the sample.

Misaligned list items are the next frequent break. A dash has to sit at the right column under its key. If a child of the list is indented less than the dash, or a sibling key is mixed into the list by mistake, the parser stops. Read the line number in the notice, then compare that line with the key above it. The column number is the other half of the same hint: it marks where on that line the parser gave up, which is often the dash, the tab, or the extra token.

Unquoted values that look like numbers change type. 1.10 becomes 1.1, and 0123 becomes 123. Leading zeros and trailing zeros after a decimal are not part of the JSON number. Quote them ("1.10", "0123") when the text is a version, a code, or an identifier. The same rule applies to booleans. An unquoted true is a boolean. The string true needs quotes. Country codes, zip codes, and port labels that only happen to be digits are the usual victims. If the characters must survive, quote them in the YAML before you convert.

Broken quotes or flow collections fail closed. A flow sequence has to end with ], and a flow mapping has to end with }. A missing closer is reported at the line where the parser stopped, which is often the next line rather than the line where the bracket opened. Scan upward from that line for the [ or { that never closed. An unmatched quote does the same kind of damage: the rest of the document is swallowed into a string until the parser cannot recover. Close the quote, then look at the next error if one appears.

Duplicate keys are an error. Parsers differ here. This one does not silently keep the last key. Rename or remove the repeated key. If you meant a merge, use << with an anchor instead of pasting the same key twice. Other hard stops are circular aliases, non-finite numbers, integers that do not fit in a JSON number, and binary values. Those are limits of JSON, not indentation mistakes. The notice names the reason. Quoting fixes the integer case. The others need a different representation before JSON can hold them.

The editor surfaces the first parse error so you can fix the line and convert again. It does not list every problem in the file at once. Correct the first line, and the next error, if there is one, appears in the same place. That single-note style is deliberate: a long list of follow-on errors is usually noise caused by the first break. If the message has no line, the input is often truncated, such as a JSON value that simply ends early. Paste the rest of the document and try again.

Short example

The fragment below is the sort of snippet this YAML parser is meant for. The comment is intentional. It is in the YAML so you can see that it disappears in the JSON, while the boolean and the port list remain. Nothing else is rewritten: the name stays a string, and debug stays a boolean because it was not quoted.

YAML

service:
  name: api
  ports: [8080, 8081]
  # staging only
  debug: true

JSON (comments removed)

{
  "service": {
    "name": "api",
    "ports": [8080, 8081],
    "debug": true
  }
}

In the editor, pretty-printing uses two spaces, so a short array is written one value per line. The values are the same as the JSON above. Paste the YAML into the converter if you want that expanded form, then copy or download it.

A multi-document stream uses the same parser and a different JSON shape. Documents separated by --- become one array. Two small resources look like this:

YAML

---
name: web
---
name: worker

JSON array

[
  { "name": "web" },
  { "name": "worker" }
]

Paste only the service example and you get one object, not an array. The array appears when a --- separator actually splits the buffer into more than one document. That is the behavior to expect from a Kubernetes-style manifest that stacks a Service and a Deployment in a single paste.

Privacy

Nothing you paste is uploaded for conversion. The YAML to JSON parser runs on your device. Loading the site still fetches static assets from the host; editor contents are not part of that request. Copy writes to the clipboard through the browser. Download builds a file in the tab and saves it locally. Neither action sends the document to this site.

The converter does not set cookies and does not use browser storage. There is no account and no history of past documents. Opening the page can still show up in ordinary hosting logs: IP address, user agent, and the URL. Those logs are not the YAML. The privacy page states the same boundary in more detail, including what a page view contains and what it does not.

If you are about to paste a secret, treat the page like any other local editor. The text sits in memory in that tab until you clear it or close it. Do not expect the site to store it, and do not expect the site to receive it. For a longer checklist of what the conversion keeps and drops, see how to convert YAML to JSON.

Questions

Is this YAML to JSON converter free?

Yes. It is free to use. There is no account, no sign-up, and no payment.

Is my YAML private? Does conversion stay in the browser?

Yes. The parser runs on your device. Text you paste is not uploaded for conversion. Loading the page still requests the site’s files from the host, but the editor contents are not part of that request.

What is the difference between YAML and JSON?

YAML is a readable format for config and data. It allows comments, anchors, and light punctuation. JSON is stricter and is what many APIs and tools expect. JSON has no comments, so comments are dropped. Anchors are resolved into repeated values.

What should I check if my YAML is invalid?

Indent with spaces, not tabs. Keep list items and keys aligned. Close quotes and brackets. If a value should stay a string, quote it — unquoted 1.10 becomes 1.1, and unquoted 0123 becomes 123. The note above the editors shows the first problem the parser finds, including a line and column when it has one.

How do I copy the JSON output?

Click Copy beside the output. The formatted text goes on your clipboard. Copy stays unavailable while the input is empty or invalid. Download, next to Copy, saves converted.json or converted.yaml instead.

Can I convert JSON to YAML here too?

Yes. Switch the direction to JSON to YAML, paste JSON on the left, and copy the YAML output. Both directions stay on this page.

Is this a YAML formatter or only a converter?

The main job is YAML to JSON conversion. The JSON side is pretty-printed (formatter-style indentation). YAML comments are not preserved in JSON because JSON has no comment syntax.

Does it work as a YAML parser for multi-document files?

Yes. Streams separated by --- convert to a JSON array with one element per document—handy for Kubernetes-style manifests.