← ihatecalc

JSON to YAML Converter

Strings that YAML could misread, such as "yes", "123", "null" or text containing a colon, are quoted so they stay strings.

What does this converter do?

YAML is the format behind many configuration files, such as Docker Compose, Kubernetes manifests, GitHub Actions and OpenAPI specs. JSON is what most APIs return. This tool turns JSON into YAML so you can drop it into a config file, keeping nested objects, lists and data types intact.

How to use it

  1. Paste your JSON.
  2. Pick 2 or 4 spaces of indentation and press Convert.
  3. Copy the YAML into your file. If the JSON is invalid you will see the error instead.

Example

This JSON:

{"name":"api","debug":false,"ports":[80,443],"owner":{"name":"Asha"},"note":"yes"}

becomes:

name: api
debug: false
ports:
  - 80
  - 443
owner:
  name: Asha
note: "yes"

Why some strings get quotes

YAML guesses types from plain text, so the word yes, the text 123 or the value null would be read as a boolean, a number or null if left unquoted. To keep them as strings the converter adds double quotes. It does the same for empty strings, text with a colon followed by a space, text that starts with a special character, and text with leading or trailing spaces.

Frequently asked questions

Is every JSON file valid YAML?

Almost. YAML 1.2 is designed as a superset of JSON, so JSON is usually valid YAML already. Converting gives you the more readable block style that people expect in config files.

Are comments kept?

JSON has no comments, so there is nothing to carry over. You can add YAML comments with # after converting.

What about very large numbers?

The browser reads JSON numbers as floating-point values, so integers above 9,007,199,254,740,991 can lose precision. Put such values in strings if you need every digit.

Can I convert YAML back to JSON?

Yes, use the YAML to JSON converter.

Is my data uploaded?

No. The conversion runs in your browser.

Related tools

YAML to JSON · JSON Formatter · JSON Validator · XML to JSON

Results are estimates for information only and are not financial, tax or legal advice.