Skip to content

JSON to YAML

Turn JSON into clean, portable YAML using a documented safe data subset.

JSON → YAML116 characters
Paste configuration text. The live preview stays inert and is limited for responsiveness.
YAML previewReady
project: toolbox
enabled: true
ports:
  - 3000
  - 3001
service:
  name: api
  retries: 2
Processed on your device

How it works & useful details

Output format

Input uses the shared bounded JSON parser. The export emits a safe YAML data subset with two-space indentation, quoted strings where needed, and explicit empty maps/lists. It does not emit anchors, tags, flow collections, block scalars, or custom YAML types.

Object member order and array order are retained. JSON duplicate names follow standard JSON parsing and keep the last value.

Private, bounded processing

This workspace parses text only in your browser. It never opens links, requests external entities, runs pasted configuration, or saves your document. Input is limited to 500,000 characters; conversion output is limited to 1,000,000 characters.

About this tool

JSON to YAML turns JSON into readable YAML that is safe to use in configuration files and pipelines. It targets a documented, portable subset that avoids YAML features which behave differently between parsers.

Strings that could be mistaken for numbers, dates, or booleans are quoted so they keep their type. The conversion happens in your browser and nothing is fetched or stored.

How to use it

  1. Paste the JSON document.
  2. Run the conversion to produce YAML.
  3. Review the output, especially quoting of ambiguous strings.
  4. Copy or download the YAML file.

Worked example

{"project":"toolbox","enabled":true,"version":"1.10","country":"NO",
 "ports":[3000,3001],"service":{"name":"api","retries":2},"tags":[]}

becomes

project: toolbox
enabled: true
version: "1.10"
country: "NO"
ports:
  - 3000
  - 3001
service:
  name: api
  retries: 2
tags: []

Look at the quoted values. Unquoted, 1.10 would be read back as the number 1.1. NO is read as false by many YAML parsers, which is the famous "Norway problem" in country lists. The converter quotes such strings so every parser reads them as text.

Safe, portable output

YAML has two major versions and many parser quirks. YAML 1.1 parsers, still common in Python and older Go and Ruby libraries, treat yes, no, on, off, dates, and numbers with leading zeros or 0x prefixes as special types. The output quotes all of these and uses plain two-space block style, without anchors, tags, or multi-line string syntax. The result reads the same in Kubernetes, Docker Compose, GitHub Actions, Ansible, and Python.

Key order and array order are preserved, so the YAML follows the structure of your JSON. Comments cannot be generated, because JSON has none. Add them to the YAML afterwards where they help readers.

Frequently asked questions

Which YAML features are avoided?

Anchors, aliases, tags, and other advanced features are not generated, keeping the output portable across parsers.

Why are some strings quoted?

Values that would otherwise parse as numbers, booleans, or dates are quoted so they remain strings.

What is the limit?

Up to 500,000 characters of JSON input.

Is JSON valid YAML already?

Mostly. YAML 1.2 is a superset of JSON, so many parsers accept JSON directly. Converting gives a more readable, conventional block style.