Why some strings are quoted
YAML guesses the type of unquoted values, and the guesses changed between versions. YAML 1.1, still used by PyYAML, Ruby and many CI systems, reads yes, no, on, off, y and n as booleans, 010 as the octal number 8, 1:30 as a number of minutes, and 2026-11-10 as a date. YAML 1.2 reads most of these as strings. The infamous example is the country code for Norway, NO, turning into false.
This tool quotes every string that either version would read as something else, and leaves everything else unquoted. The output means the same thing to every parser.
How to use the JSON to YAML
- Paste JSON, or press Sample.
- Choose the indent and quote style.
- Copy the YAML or download it as a .yaml file.
Examples
A Kubernetes Deployment
{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"name":"web","labels":{"app":"web","tier":"frontend"}},"spec":{"replicas":3,"template":{"spec":{"containers":[{"name":"web","image":"nginx:1.27","ports":[{"containerPort":80}]}]}}}}apiVersion: apps/v1
kind: Deployment
metadata:
name: web
labels:
app: web
tier: frontend
spec:
replicas: 3
template:
spec:
containers:
- name: web
image: nginx:1.27
ports:
- containerPort: 80
Strings YAML parsers would misread
{"python":"3.10","country":"NO","enabled":"yes","port":"8080","debug":false,"tags":["on","off"]}python: "3.10"
country: "NO"
enabled: "yes"
port: "8080"
debug: false
tags:
- "on"
- "off"
Unquoted, 3.10 would become the number 3.1, NO, yes, on and off booleans in YAML 1.1, and 8080 a number. debug is a real boolean, so it stays unquoted.
Exact numbers
{"id":12345678901234567890,"ratio":1e-7,"price":19.90}id: 12345678901234567890
ratio: 1.0e-7
price: 19.90
The ID keeps all 20 digits and the price its trailing zero.
Numbers
Numbers are copied from your JSON exactly, so large IDs and precise decimals don't lose digits. The one change is for exponents: YAML 1.1 only recognises floats with a dot and a signed exponent, so 1e-7 is written 1.0e-7, which both versions read as the same number.
Options
- Indent
- 2 spaces (the default) or 4. Lists are indented under their key.
- Quotes
- Double quotes (the default) or single quotes for strings that need them. Strings with line breaks or control characters always use double quotes.
- Start with ---
- Begin with a document marker, as some tools and multi-document files expect.
Limitations
- The output is block-style YAML without comments, anchors or custom tags; JSON has none of these.
- Inputs up to 10 MB. Duplicate keys in the JSON keep the last value, as
JSON.parsedoes.
Frequently asked questions
Is my JSON uploaded?
No. The conversion runs in your browser; nothing you paste is sent anywhere.
Is all JSON valid YAML?
Yes: YAML 1.2 is a superset of JSON, so a YAML parser can read JSON as it is. Converting gives the more readable block style used in configuration files.
Why is the Norway problem a problem?
In YAML 1.1, unquoted NO is the boolean false, so a list of country codes silently loses Norway. Quoting it, as this tool does, keeps it a string in every parser.
How do I convert YAML back to JSON?
Use the YAML to JSON converter.