Free online tool

JSON to YAML Converter

Paste JSON and get clean YAML that YAML 1.2 and YAML 1.1 parsers read back as the same data, with YAML to JSON one click away.

Convert JSON to YAML, or YAML to JSON

Paste, open or drop a file. The result updates as you type. YAML made from JSON of up to 600,000 values is parsed back and compared with the JSON before it is shown.

Direction
YAML output

Files are read and converted in your browser and nothing is uploaded; only your option choices are remembered in this browser, never the text. Input up to 10 MiB; YAML up to about 800,000 values per document (fewer in long documents) and 1,500,000 in all. YAML comments are dropped when converting to JSON, because JSON has no comments.

Quoted where YAML would guess

Strings such as yes, NO, on, 1.10, 0755, 22:22 and 2026-11-17 are quoted, so YAML 1.2 parsers and YAML 1.1 readers such as PyYAML, Kubernetes and Ruby keep them as text. Numbers keep every digit, and key order is unchanged.

Checked by parsing it back

YAML made from JSON of up to 600,000 values is read back as YAML 1.2 and as YAML 1.1 and compared with your JSON, value by value and key by key. If any value would come back different, you get an error instead of YAML that quietly changes your data. Larger JSON is written by the same rules, and the page says it was not checked.

YAML to JSON for real config files

Switch direction to turn Kubernetes manifests, Compose files, GitHub Actions workflows and OpenAPI specs into JSON. Anchors and << merge keys are expanded, and a file with several documents becomes an array, or you pick one.

How to convert JSON to YAML

  1. 1

    Paste your JSON, open a .json file or drop it onto the converter.

  2. 2

    Pick the indentation, the list style, and whether to quote every string or start with ---.

  3. 3

    Read the YAML and the notes, for example which strings were quoted or which keys were duplicated.

  4. 4

    Copy the YAML or download it as a .yaml file, or switch direction to turn YAML back into JSON.

What people use this tool for

  • Turn the JSON from kubectl get -o json or a cloud API into a Kubernetes manifest you can read and edit.
  • Write a docker-compose file or a GitHub Actions workflow from JSON generated by a script.
  • Publish an OpenAPI spec as YAML, with response codes such as "200" quoted the way the spec recommends.
  • Convert a YAML config file to JSON for a JavaScript app, a JSON Schema validator or an API request.

Frequently Asked Questions

How do I convert JSON to YAML?

Paste JSON into the left box, open a .json file or drop one on the panel. The YAML appears as you type. Choose 2 or 4 spaces, whether lists sit under their key or level with it as kubectl writes them, whether to quote every string and whether to start with ---, then copy the YAML or download it as a .yaml file. Files up to 10 MiB are converted in your browser.

Why are some values in quotes in the YAML output?

A YAML parser decides the type of unquoted text by how it looks. YAML 1.1 parsers such as PyYAML, Ansible and Ruby's read NO and on as booleans, 0755 as the octal number 493, 22:22 as the base-60 number 1342 and 2026-11-17 as a date. Kubernetes also reads NO and on as booleans, and every parser reads 1.10 as the number 1.1. The converter quotes any string that YAML 1.2 or YAML 1.1 could read as another type, so country: "NO" stays the text NO. Keys get the same treatment, so "on": and "200": are quoted too.

Are big numbers and long decimals kept exactly?

Yes. Numbers are copied digit for digit, so 12345678901234567890 and 0.10000000000000000555 stay as written, while JavaScript's JSON.parse would turn them into 12345678901234567000 and 0.1. Exponents are written in a form YAML 1.1 also reads as a number: 1e3 becomes 1.0e+3, because PyYAML treats 1e3 as text. Going from YAML to JSON, integers in hex, octal or any length are converted exactly, and decimals keep their digits.

How are multi-line strings written?

Text with line breaks becomes a literal block that starts with |. The block uses |- when the text has no final line break and |+ when it ends with blank lines, and adds an indentation number such as |2 when the text starts with a space, so the text comes back exactly. Long lines are never folded. Text that contains control characters or Windows line endings is double-quoted with escapes such as \r\n and \u0007 instead.

What happens to duplicate keys?

YAML does not allow the same key twice in one mapping. When your JSON repeats a key, the last value is kept in the position of the first, which is what JSON.parse and Python's json.loads do, and the page lists the duplicated keys, such as $.spec.replicas, so you can check them. In the other direction, a YAML file with a duplicated key is reported as an error with its line number.

How does YAML to JSON handle anchors, merge keys and several documents?

Aliases such as *defaults are expanded into full copies. Before anything is written, the converter adds up how much every alias and << merge would add, and refuses a file whose JSON would pass 64 MiB or whose merges would copy more than a million entries, so a "billion laughs" file is stopped at once. A conversion still running after 30 seconds is stopped too. << merge keys are applied as Compose and GitLab CI expect: keys written in the mapping win, and in a list such as <<: [*a, *b] the earlier maps win. A second << in the same mapping is an error, like any repeated key. You can switch merging off. Documents separated by --- become a JSON array, or you choose one; Kubernetes documents are labelled by kind and name.

What is lost when converting YAML to JSON?

Comments, because JSON has none. Custom tags such as !Ref are dropped and their values kept, and dates, .inf and .nan stay as text, since JSON has no types for them; the notes under the result say what changed and on which line. Keys stay exactly as written, so on: becomes "on". YAML 1.2 is the default; choose YAML 1.1 to read yes, no, on and off as booleans and 0644 as octal 420, as PyYAML and Ansible do. Kubernetes reads those values the same way but differs on rarer forms, such as y, 1e3 and 22:22.

What are the limits, and is my data uploaded?

Files and pasted text can be up to 10 MiB. JSON of up to 600,000 values, where every key and every value counts as one, is also checked by parsing the YAML back; larger JSON is converted by the same rules without that check, and the page says so. YAML is refused when reading it would use too much memory in a browser tab: one document of more than about 800,000 values, or fewer in a long document, because its text counts too (roughly 6 MiB of JSON-style text or 9 MiB of block YAML in one document), or more than about 1.5 million values in all documents together. Long results show their first 5,000 lines in the box, while Copy and Download include everything. Nothing is uploaded: files are converted in a background worker in your browser, and only your option choices, such as the indentation, are stored, in this browser's local storage under zutilium:json-to-yaml.