All tools

JSON to YAML converter

Convert JSON into clean, readable YAML.

JSON to YAML converter
Indentation
Strings
Options
InputValid JSONJSON

Press Command or Control plus Enter to run. Tab inserts indentation; press Escape, then Tab, to leave the editor.

Result
Your result will appear here.
Ready8 lines · 230 chars

About the JSON to YAML converter

YAML is the format of Kubernetes manifests, Docker Compose files, GitHub Actions workflows and many other config files. It holds the same data as JSON but uses indentation instead of braces and quotes, so it's easier to read and edit.

This converter turns any JSON into clean YAML and quotes strings only where needed. By default it also quotes values like no, on and dates, which older YAML parsers would otherwise read as booleans or dates.

How to use the JSON to YAML converter

  1. Paste your JSON into the editor, open a .json file, or click Load sample.
  2. Choose the indentation and how strings should be quoted.
  3. Click Convert to YAML or press Ctrl + Enter (Cmd + Enter on Mac).
  4. Copy the result or click Download .yaml.

Examples

Kubernetes-style config

Input

{"apiVersion":"v1","kind":"Service","metadata":{"name":"web"},"spec":{"ports":[{"port":80,"targetPort":8080}],"selector":{"app":"web"}}}

Output

apiVersion: v1
kind: Service
metadata:
  name: web
spec:
  ports:
    - port: 80
      targetPort: 8080
  selector:
    app: web

Strings that YAML would misread are quoted

Input

{"country":"NO","enabled":"yes","version":"1.10","port":"8080"}

Output

country: "NO"
enabled: "yes"
version: "1.10"
port: "8080"

Unquoted, older YAML parsers read NO and yes as booleans and 1.10 as the number 1.1.

Common errors and how to fix them

The Norway problem: NO became false

YAML 1.1 parsers read yes, no, on and off as booleans. Quote these strings, which the YAML 1.1 safe option does for you.

found character that cannot start any token

The YAML contains a tab for indentation, or a value starting with @ or a backtick. Use spaces only, and quote values that start with special characters.

Expected double-quoted property name in JSON at position 26 (line 1 column 27)

The input isn't valid JSON yet. Fix the trailing comma, quotes or comments first; the JSON editor label shows the exact position.

Good to know

  • Objects become key: value lines, arrays become - item lists, and strings with line breaks become | block text.
  • Quote yes/no/on/off and dates keeps strings such as "no", "on" and "2026-01-01" quoted. Without quotes, YAML 1.1 parsers (including PyYAML and many older tools) read them as booleans or dates. This is often called the Norway problem, because the country code NO became false.
  • Empty objects and arrays are written as {} and []. Key order is kept unless you choose Sort keys alphabetically.
  • The input must be valid JSON. The badge above the editor shows the line and column of the first syntax error.

Frequently asked questions

Is YAML a superset of JSON?

YAML 1.2 is designed so that most JSON is also valid YAML, so a YAML parser can usually read JSON directly. Converting to proper YAML style just makes the file much easier to read and edit.

Why are some values in quotes?

Quotes are added where a plain value would be read as something else: a number-like string such as "1.0", "null", a value starting with #, or one containing : . That keeps the data identical to your JSON.

Should I use 2 or 4 spaces?

2 spaces is the common convention for Kubernetes, Docker Compose and GitHub Actions. Either works, as long as one file uses the same indentation throughout.