Skip to content
JustTools

JSON to YAML Converter

Turn JSON into clean YAML — or YAML back into JSON — as you type. Text that some YAML tools would misread, such as “no”, “0755” and dates, is quoted for you, and errors point to the exact line.

Runs in your browser Free · no sign-up

At a glance

  • Converts JSON to YAML and YAML to JSON, instantly as you type. Switching direction carries the result across.
  • Safe quoting: text such as yes, no, on, 0755, 1:30 and 2026-01-15 is written in quotes, because YAML 1.1 tools like PyYAML and Ansible would otherwise read it as true or false, a number or a date.
  • Numbers are copied digit for digit: 1.50 stays 1.50, and a 20-digit ID is not rounded.
  • When reading YAML you choose YAML 1.2 (the current standard) or YAML 1.1. Every unquoted value whose meaning depends on that choice is listed with its line number.
  • Anchors, aliases and merge keys (<<) are replaced by the data they point to, and several documents separated by --- become one JSON array.
  • Mistakes are reported with their line and column. A key written twice in one mapping is refused rather than silently overwritten.
  • Layout options: 2 or 4 spaces, quotes only where needed or on every string, lists indented or level with their key, short lists on one line, sorted keys and wrapping at 80 or 120 columns.
  • Runs in your browser: the configs and API responses you paste are never uploaded.

Step by step

How to convert JSON to YAML

  1. 1

    Add your JSON

    Paste JSON into the input, or click Open file to load a .json file. Comments and trailing commas are accepted.

  2. 2

    Choose the layout

    Pick 2 or 4 spaces, and open Options for quote style, list indentation, sorted keys or short lists on one line.

  3. 3

    Check the result

    The YAML appears as you type. If the JSON has a mistake, its line and column are shown.

  4. 4

    Copy or download

    Copy the YAML or download it as a .yaml file. Choose YAML → JSON to convert in the other direction.

Features

Everything you need, nothing you don’t

Both directions

JSON → YAML and YAML → JSON in one tool. Convert a file, edit it, and switch direction to turn it back.

No Norway problem

The country code NO, the answer yes and the mode 0755 keep their quotes, so no parser turns them into false, true or 493.

Shows what is ambiguous

Paste YAML with a bare no or 0755 and you are told how YAML 1.1 and 1.2 each read it, and on which line.

Exact numbers

Prices, version numbers and long IDs are written exactly as they were, not passed through a floating-point number.

Exact error locations

Bad indentation, a missing quote or a duplicate key is reported with its line and column, and one click jumps to it.

Private

Kubernetes manifests, Compose files and CI configs are converted on your device. Nothing is sent to a server.

How JSON maps to YAML

JSONYAML
{"name": "shop", "port": 8080}name: shop and port: 8080 on separate lines
"tags": ["api", "v2"]tags: followed by - api and - v2
"db": {"host": "x"}db: followed by an indented host: x
"debug": "no"debug: "no" (quoted, so it stays text)
"price": 1.50price: 1.50 (digits kept)
"note": "line one\nline two"a |- block with one line of text per line
"owner": null, "tags": [], "extra": {}owner: null, tags: [], extra: {}

The same YAML, read two ways

YAML 1.2 has been the standard since 2009, but many widely used tools still follow YAML 1.1, and the two disagree about unquoted values. This is why a list of country codes can end up containing false instead of NO — the “Norway problem”.

Written in YAMLYAML 1.2 readsYAML 1.1 reads
debug: nothe text “no”false
country: NOthe text “NO”false
mode: 0755the number 755the number 493 (octal)
time: 1:30the text “1:30”the number 90 (base 60)
port: 0o17the number 15the text “0o17”
on: pusha key named “on”a key named true
date: 2026-01-15the text “2026-01-15”a date

What YAML features become in JSON

  • Anchors (&name) and aliases (*name) are replaced by a full copy of the data, and merge keys (<<: *name) are merged into the mapping.
  • Several documents separated by --- become one array, with one entry per document.
  • Block text written with | keeps its line breaks; text written with > is joined into one line.
  • Comments are dropped, because JSON has nowhere to keep them.
  • .inf and .nan become null, since JSON has no way to write them. Binary data (!!binary) stays as Base64 text.
  • Keys that are not text, such as numbers or lists, are turned into text, because every JSON key is a string.

FAQ

Frequently asked questions

Is it safe to convert config files with secrets here?

Yes. The conversion runs in your browser, so manifests, environment files and API responses are never uploaded or stored.

Why are some strings in quotes and others not?

YAML only needs quotes when text could be read as something else. With Safe for YAML 1.1 tools on, that includes yes, no, on, off, numbers with a leading zero, values like 1:30 and dates. Choose Double or Single under Quotes to quote every string instead.

What is the difference between YAML 1.1 and YAML 1.2?

They read unquoted values differently. In YAML 1.1, yes, no, on and off are booleans, 0755 is an octal number and 1:30 is 90. In YAML 1.2 the first group is plain text and 0755 is 755. PyYAML and Ansible follow 1.1; newer parsers follow 1.2. This tool tells you when your YAML contains such values.

Why did my key “y” or “on” get quotes?

YAML 1.1 treats y, n, yes, no, on and off as booleans even when they are keys, so some parsers would turn the key on into true. The quotes prevent that. Turn off Safe for YAML 1.1 tools if you only use YAML 1.2 parsers.

Are comments kept when converting YAML to JSON?

No. JSON has no comments, so they are left out, and the tool says so below the result.

Can I convert a file with several YAML documents?

Yes. Documents separated by ---, as in many Kubernetes files, become one JSON array with an entry for each document.

Does it accept JSON with comments or trailing commas?

Yes. Comments, trailing commas, single quotes and unquoted keys are repaired, and the tool lists what it fixed. Real mistakes are reported with their line and column.

Is .yml different from .yaml?

No. Both extensions hold the same format. The download uses .yaml, the extension the YAML project recommends; rename it to .yml if your tool expects that.

Keep going

Browse every tool

Last updated Report a problem or suggest a feature