JSON to YAML and YAML to JSON

Paste JSON to get YAML, or YAML to get JSON. Useful for Kubernetes and Docker Compose files, CI pipelines, OpenAPI documents and application settings.

  • Free
  • No sign-up
  • Runs in your browser
json-to-yaml

100% private — your text is processed in your browser and never sent to any server.

Next step

Keep going with your result in another tool. Nothing is uploaded.

How it works

Paste your JSON or YAML

A configuration file, an API definition, a manifest or a snippet.

Choose the direction

JSON to YAML or YAML to JSON, with the indentation you prefer.

Copy the result

Errors are reported with their line and column so you can fix them.

Same data, two notations

JSON and YAML can describe exactly the same data: objects, lists, strings, numbers, booleans and null. JSON is strict and compact, and it is what programs and web APIs speak. YAML is written for people, with indentation instead of braces, comments and less punctuation, and it is the language of many configuration files: Kubernetes manifests, Docker Compose, GitHub Actions and other CI pipelines, OpenAPI descriptions and Ansible playbooks. Moving from one to the other is a regular chore, and this tool does it in a click.

JSON to YAML

Paste JSON and get readable YAML with the indentation you choose. Objects become indented key-value pairs, lists become dashed items and strings that could be mistaken for something else, such as "true" or "123", are quoted, so their type survives the trip. Keys can be sorted alphabetically. If the JSON has the usual problems of copied text, such as single quotes, trailing commas or comments, the repair option fixes them first.

YAML to JSON

Paste YAML and get valid JSON. Anchors and aliases are resolved, and multi-line strings are read according to the YAML rules. A file with several documents separated by three dashes gives an array with one entry per document. If the YAML is invalid, for example because of a bad indentation, you get the line and column of the problem and a short reason. Dates written the YAML way are converted to ISO text.

Watch for the differences

  • YAML supports comments and JSON does not, so comments are lost when converting to JSON.
  • YAML has features JSON lacks, such as anchors and custom tags; the converter resolves what it can and rejects unsafe or unknown tags rather than guessing.
  • In YAML, unquoted values such as yes, no and on may be read as booleans by some tools, and version numbers like 1.10 as numbers. This converter follows the YAML 1.2 rules used by most modern tools; quote such values if in doubt.

What it does not do

It does not validate against a schema such as a Kubernetes or OpenAPI definition; it checks syntax only. The formatting of the YAML it produces is the standard style, and it will not preserve the original layout, comments or key order of a document when going through JSON. To format or check plain JSON, use the JSON formatter.

More developer and text tools

Frequently asked questions

How do I convert JSON to YAML?
Paste your JSON, keep "JSON to YAML" selected and copy the result. Choose 2 or 4 spaces of indentation.
How do I convert YAML to JSON?
Choose "YAML to JSON" and paste your YAML. If it contains several documents, you get an array with one entry per document.
Are YAML comments kept?
No. JSON has no comments, so they are dropped when converting from YAML to JSON.
What if my YAML has an indentation error?
The tool reports the line and column of the problem and a short reason, so you can fix it.
Does it work for Kubernetes and Docker Compose files?
Yes, it converts the syntax. It does not validate the content against Kubernetes or Compose rules.
Is my file uploaded anywhere?
No. The conversion runs in your browser.