Skip to content

JSON to YAML Converter

Paste JSON from an API, a config file or package.json and get YAML you can drop into a Kubernetes manifest, CI pipeline or docker-compose file. Ambiguous strings are quoted, multi-line strings become block scalars, and nothing leaves your browser.

Loading editor...
Paste or type JSON
Loading editor...
YAML output
Auto-run ON

How to convert JSON to YAML

  1. Paste JSON into the left panel, drag a .json file onto it, click upload (up to 5 MB) or use Load from URL.
  2. YAML appears on the right as you type. Choose 2 Spaces, 3 Spaces or 4 Spaces from the indent dropdown. Tab falls back to 2 spaces because YAML does not allow tabs for indentation.
  3. If the input is not valid JSON, the error bar shows the line and column. Click Fix to repair trailing commas, comments or single quotes, then Undo fix if needed.
  4. Click Copy or Download .yaml.

What the output looks like

Input:

{
  "orderId": 1042,
  "customer": { "name": "Maya Patel", "vip": true },
  "items": [
    { "sku": "A-100", "qty": 2, "price": 4.5 },
    { "sku": "B-220", "qty": 1, "price": 12 }
  ],
  "shippedAt": "2026-06-23T14:30:00Z",
  "notes": null
}

Output with 2-space indent:

orderId: 1042
customer:
  name: Maya Patel
  vip: true
items:
  - sku: A-100
    qty: 2
    price: 4.5
  - sku: B-220
    qty: 1
    price: 12
shippedAt: '2026-06-23T14:30:00Z'
notes: null

shippedAt is quoted because an unquoted timestamp would be parsed as a date. Maya Patel and A-100 cannot be mistaken for anything else, so they stay plain.

Limits and notes

  • Files up to 5 MB. Everything runs in your browser; nothing is sent to a server.
  • Quoting: strings such as 'true', '123', '3.14', 'null', '~', 'yes', 'on', 'NO', '0x1f', dates, timestamps and the empty string are single-quoted. Keys get the same treatment, so a key named n or y is written as 'n' because older YAML 1.1 parsers read it as a boolean.
  • Multi-line strings become |- block literals. Lines are never wrapped.
  • Key order is preserved. JSON null is written as null.
  • Numbers are written as JSON prints them. Integers above 2^53 are already rounded by the JSON parser, so keep large IDs as strings in your source.
  • Need to go the other way? Use YAML to JSON. To decide which format a project should use, read JSON vs YAML. If you are converting a package manifest, package.json explained covers what each field means, and comments in JSON explains why they are missing in the first place.

Frequently Asked Questions

Why are some strings quoted and others not?
A YAML parser reads unquoted NO, true, 123, 3.14, null or 2026-01-08 as a boolean, number, null or date, not as text. This is the so-called Norway problem. The converter quotes any string that could be misread and leaves ordinary strings plain.
Which indent should I use?
2 spaces is the convention for Kubernetes, GitHub Actions, docker-compose and most YAML you will meet. Pick 3 or 4 to match an existing file. YAML forbids tabs for indentation, so the Tab setting is treated as 2 spaces.
Are comments preserved?
JSON has no comments, so there is nothing to carry over. If your input has // comments, the Fix button removes them before converting. Add YAML comments afterwards with #.
Does the output use anchors or aliases?
No. Repeated values are written out in full each time, which keeps the file readable and compatible with every YAML parser.
How are long strings and line breaks handled?
A string containing line breaks becomes a block literal (|-) with one line per row. Long lines are never wrapped, so URLs and tokens stay intact.
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.

YAML to JSON Converter

Convert YAML to JSON in your browser. Multi-document files become an array, anchors and aliases are resolved, and only null, true, false and plain numbers are typed, so yes, NO and dates stay strings.

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.