Skip to content

YAML to JSON Converter

Paste a docker-compose file, Kubernetes manifest, CI config or OpenAPI spec and get formatted JSON with a collapsible tree. Anchors are expanded, documents separated by --- become an array, and nothing leaves your browser.

Loading editor...
Paste YAML
Loading editor...
Output
Auto-run ON

How to convert YAML to JSON

  1. Paste YAML into the left panel, drag a .yaml or .yml file onto it, click upload (up to 5 MB) or use Load from URL.
  2. JSON appears on the right as you type. Use Tree to browse nested sections or Code for the text; the indent dropdown sets 2, 3 or 4 spaces or tabs.
  3. If the YAML is invalid, the error bar shows the line, the column and a pointer to the offending character. Typical causes are tabs used for indentation, an unclosed [ or {, and tags the JSON schema does not know.
  4. Click Copy or Download .json.

What the output looks like

Input:

app: inventory
replicas: 3
features:
  - search
  - export
database:
  host: db.internal
  port: 5432
  ssl: true
owner: null

Output:

{
  "app": "inventory",
  "replicas": 3,
  "features": ["search", "export"],
  "database": {
    "host": "db.internal",
    "port": 5432,
    "ssl": true
  },
  "owner": null
}

A multi-document file converts to an array:

name: api
---
name: worker
[{ "name": "api" }, { "name": "worker" }]

Limits and notes

  • Files up to 5 MB. Everything runs in your browser; nothing is sent to a server.
  • Typing follows the JSON schema of YAML: lowercase null, true, false and plain decimal numbers (including 1e3) are typed. ~, Null, True, yes, on, NO, 0x1f, 1_000, 010, .inf, dates and timestamps all stay strings. An empty value becomes ""; see null vs undefined in JSON for how to treat it downstream.
  • Tags are not supported. Custom tags such as !custom and even built-in ones such as !!timestamp raise an error. Remove the tag or quote the value.
  • Aliases are copied in full. JSON has no references, so a value used three times appears three times. Merge keys (<<) are not expanded.
  • Key order is preserved. Comments are dropped because JSON has none.
  • Dates stay as the text you wrote. JSON date format explains why ISO 8601 strings are the safe choice.
  • Need the reverse? Use JSON to YAML. To compare the formats for configuration files, read JSON vs YAML.

Frequently Asked Questions

What happens to a file with several --- documents?
Each document becomes one element of a JSON array, in order. A file with a single document converts to that object or array directly, with no wrapper.
Why is yes a string and not true?
The converter uses the JSON schema of YAML, where only lowercase null, true and false and plain decimal numbers are typed. yes, on, NO, True and ~ stay strings. This avoids the Norway problem, where NO silently becomes false. If you need a boolean, write true or false.
Are anchors and aliases supported?
Yes. &anchor defines a value and *alias repeats it; the JSON output contains a full copy at every alias. Merge keys (<<) are not expanded and appear as a literal "<<" key.
Why do dates come out as strings?
JSON has no date type, and the JSON schema of YAML does not parse timestamps, so 2026-01-08 is kept exactly as written. Your code can parse it when needed; see the JSON date format guide linked below.
What does an empty value become?
A key with nothing after the colon becomes an empty string. Write null explicitly if you want JSON null. The ~ shorthand is treated as the string ~ under the JSON schema.
Is my data uploaded?
No. Parsing and conversion run as JavaScript in your browser tab. You can disconnect from the network after the page loads and the tool keeps working.

Guides that go with this tool

More JSON tools

JSON Viewer (Tree View)

Explore any JSON document as a collapsible tree in your browser. Click a key to copy its JSONPath, click a value to copy it, and page through large arrays without freezing the tab.

JSON Fixer: Repair Invalid JSON

Repair broken JSON in your browser. Strips markdown fences and prose, fixes trailing commas, single quotes, comments, unquoted keys, Python literals and unclosed brackets, and lists every problem it detected.

JSON to CSV Converter

Convert a JSON array of objects to CSV in your browser. Nested objects are flattened to dotted columns, values are quoted correctly, and Excel-friendly output is one click away.

CSV to JSON Converter

Convert CSV with a header row into a JSON array of objects in your browser. Numbers and booleans are detected, leading-zero codes stay strings, and the delimiter is picked up automatically.

JSON to YAML Converter

Convert JSON to clean YAML in your browser with 2, 3 or 4 space indentation. Strings that a YAML parser would read as numbers, booleans or dates are quoted so they survive the round trip.

JSON to XML Converter

Convert JSON to XML in your browser. Choose the root and array item element names, nulls become xsi:nil, keys are sanitised into valid XML names, and text is escaped.

XML to JSON Converter

Convert XML to JSON in your browser. Attributes are kept as @_name keys, repeated tags become arrays, numbers and booleans are detected, and invalid XML reports the line and column.

JSON Compare (Diff)

Compare two JSON documents in your browser and get a structural diff that lists every changed, added, and removed value with its JSONPath. Key order and whitespace are ignored.

JSONPath Query Tester

Test JSONPath expressions against your JSON in the browser. Pick an expression, see the matches as a JSON array with a count, and explore the results in tree view.

JSON Escape / Unescape

Escape text into a JSON string literal, unescape one back to plain text, or stringify a whole JSON document to embed it inside another JSON value or in source code.