JSON to YAML Converter
Paste JSON and get readable YAML in the same window. Prettify parses the JSON in your browser, then writes block-style YAML with two-space indentation and no line wrapping. Copy the result, download it as prettify.yaml, or open it in the editor. It turns an API payload into a config file in seconds.
What the JSON to YAML converter does
The input is a JSON object or array. The output is the same data as a YAML document. Objects become mappings, arrays become sequences, and nesting turns into indentation instead of braces and brackets.
The box needs a whole document. It does not accept a bare value such as "hello". The panel answers "This is not valid JSON." Wrap the value in an object or an array first.
Key features
The YAML writer follows fixed rules, so the same JSON always gives the same YAML. You can predict the output, and you can convert it back without surprises. These are the rules that matter most when you read it.
- Lists are indented under their key, and every level uses two spaces.
- Lines are never wrapped, so a long URL or token stays on one line.
- A string that YAML would read as another type is quoted. "8080", "true", "02134", and "1.10" keep their quotes.
- A string with a line break becomes a block scalar that starts with a | marker.
- An empty array is written as [] and an empty object as {}.
- Keys follow the order of the JSON, except that keys that are whole numbers, such as "2024", move to the front.
- A null value is written as null, and an empty string is written as two single quotes.
How to convert JSON to YAML
Start in the box at the top of this page. It reads documents up to 512 KB. When the JSON has an error, the panel shows the line and column, and the button changes to "Fix it in the editor".
- Paste your JSON into the box labeled "Paste your JSON", or select "Try an example".
- Read the YAML in the result panel. A warning under the summary appears when a number could not be kept exactly.
- Select Copy to put the YAML on the clipboard, or select Download to save it as prettify.yaml.
- Select "Open in full editor". The editor opens at /app/editor with the YAML in the Raw view.
- Switch to the Tree view to check the structure, or edit the YAML in the Raw view.
- For a larger file, open the JSON in the editor, select Convert in the Transform group of the toolbar, and pick YAML.
Worked example: a service config
The JSON below describes a service. It has strings that look like other types, a value with a line break, an empty string, a null, and two empty containers. The block after it is the YAML that Prettify produces.
The version "1.10" keeps its quotes. Without them, a YAML reader would take it as the number 1.1. The same rule protects "8080", "true", and "02134". The BANNER value becomes a block scalar, and its two lines stay two lines.
EMPTY is written as two single quotes and PROXY as null, so the two stay different. The probes and labels values use the short forms [] and {}.
{
"name": "checkout-service",
"version": "1.10",
"replicas": 3,
"env": {
"PORT": "8080",
"DEBUG": "true",
"ZIP": "02134",
"BANNER": "Welcome\nback",
"EMPTY": "",
"PROXY": null
},
"ports": [
{ "name": "http", "port": 8080 },
{ "name": "metrics", "port": 9090 }
],
"probes": [],
"labels": {}
}
name: checkout-service
version: '1.10'
replicas: 3
env:
PORT: '8080'
DEBUG: 'true'
ZIP: '02134'
BANNER: |-
Welcome
back
EMPTY: ''
PROXY: null
ports:
- name: http
port: 8080
- name: metrics
port: 9090
probes: []
labels: {}Common use cases
JSON is what tools and APIs produce. YAML is what people prefer to read and edit. This page moves data from the first to the second, with no script and no install.
- Turn the output of kubectl get with -o json into a manifest that you can edit by hand.
- Draft a GitHub Actions workflow or a Compose file as JSON in a script, then convert it.
- Move an OpenAPI or JSON Schema document to YAML, which reads better in a pull request.
- Compare how a config reads in both formats before you choose one.
- Read a deeply nested response more easily, because indentation is easier to scan than brackets.
What YAML does not keep from JSON
YAML numbers follow the same rules as JavaScript numbers. A value such as 4.0 is written as 4, and an integer past 9007199254740991 is rounded. Prettify shows a warning when this happens.
To keep a long ID exact, store it as a string in the JSON. Strings pass through unchanged, and Prettify quotes the ID so that a YAML reader keeps it as text.
Frequently asked questions
Can I convert JSON that has comments or trailing commas?
Yes. Prettify reads the input as JSONC and adds a note that it ignored the comments and trailing commas. The comments do not appear in the YAML.
Why did 4.0 become 4, and why did a long ID change?
YAML numbers are plain numbers, so a trailing zero is dropped and an integer past 9007199254740991 is rounded. The panel shows a warning. Store such a value as a string in the JSON to keep it.
What happens to a key that appears twice in my JSON?
The last value wins, as it does in JSON.parse. The panel lists a warning that names the key and both values, so you can remove the extra one.
Does my JSON leave my device?
No. Parsing and writing the YAML both run in your browser tab. A payload with tokens or internal hostnames is not uploaded. Only a share link, which you create on purpose, sends data.
Can I convert the YAML back to JSON?
Yes. Use the YAML to JSON page or the Convert menu in the editor. The data comes back the same, but a number such as 4.0 returns as 4.