Skip to content
Tools

JSON to YAML Converter

Last updated:

Paste JSON and get the same data as block-style YAML: indentation instead of braces, dashes for list items and no quotes except where a value would otherwise be misread. Every JSON document is valid YAML 1.2, so the conversion never loses data.

Runs in your browser: your configuration never leaves your device – nothing is uploaded, logged or stored on a server. How we protect your data

100% in-browserNothing is uploaded

Input

Loading editor…

Paste JSON here

or drop a file anywhere in this box. Everything stays in your browser.

Drop a file to load it

Output

Loading editor…

YAML appears here

Results update as you type.

How to use the JSON to YAML

  1. Paste the JSON you want as YAML, for example a Kubernetes manifest from kubectl -o json.
  2. Pick the indent width (2 spaces is the common convention).
  3. Review quoted values; they are quoted on purpose (see below).
  4. Copy or download the .yaml file.

Worked example

A service config with values YAML could misread

Input

{"service":"api","port":8080,"debug":false,"hosts":["a.example.com","b.example.com"],"version":"1.10","enabled":"yes"}

YAML

service: api
port: 8080
debug: false
hosts:
  - a.example.com
  - b.example.com
version: "1.10"
enabled: "yes"

version and enabled are strings in the JSON. Unquoted, 1.10 would load as the number 1.1, and yes as a boolean in YAML 1.1 parsers, so they are quoted. Quote style may be single or double.

JSON and YAML side by side

JSON and YAML side by side
ConceptJSONYAML
Object{"a": 1}a: 1
List[1, 2]- 1 then - 2 on separate lines
StringAlways quotedQuoted only when needed
CommentsNot allowed# comment
Multi-line text\n escapesBlock scalars | and >
ReuseNot possibleAnchors & and aliases *

The strings YAML gets wrong

YAML infers types from bare text, which is where most config bugs come from. yes, no, on and off are booleans in YAML 1.1 (still used by many tools); 0755 can be read as octal; 1.10 becomes 1.1; a country code NO becomes false. The converter quotes such strings so they round-trip as strings.

Indentation and tabs

YAML forbids tab characters for indentation. If you edit the output, keep spaces only, and keep list dashes aligned under their parent key's indentation level or one step in – both are valid, mixing them in one list is not.

Comments cannot be generated because JSON has none; add them after converting.

JSON to YAML FAQ

Is JSON valid YAML?

Yes, YAML 1.2 is a superset of JSON, so most YAML parsers accept JSON directly. Converting is about readability: block-style YAML is easier to edit and diff by hand.

Why are some values quoted in my YAML output?

Without quotes they would load as a different type, such as yes becoming true or 1.10 becoming 1.1. Quoting keeps them strings, matching the original JSON.

Can I convert a Kubernetes JSON manifest to YAML?

Yes. Paste the output of kubectl get <resource> -o json and copy the YAML. Remove status and metadata fields like uid and resourceVersion before re-applying it.

Does the converter keep key order?

Yes, keys appear in the same order as in the JSON.

How are empty objects and arrays written?

As flow style: {} and []. Block style has no way to write an empty collection.

Related tools