JSON to YAML Converter — Convert JSON to YAML
Convert JSON to YAML (indent choice, key sorting, error positions)
Runs in your browser · nothing is uploaded
What it is
YAML is a configuration format meant to be easy for people to read and edit, used in Kubernetes manifests, GitHub Actions, Docker Compose and many other tools. When you have an API response or a config in JSON and need it as YAML, paste it here. The result appears as soon as you paste.
How to use
- Paste your JSON into the input.
- Choose 2 or 4 space indentation. Most YAML tooling uses 2 by convention.
- Turn on Sort keys if you want alphabetical order at every level.
- Copy the result. If the JSON has an error, the line and column are shown.
How it works
- Input is strict JSON per RFC 8259. Output is produced by the js-yaml library in a form compatible with the YAML 1.2 core schema.
- A string that could be read as another type, like
true,null,123or007, is quoted automatically, so a round trip does not change types. - Korean, Chinese and emoji characters are written as they are, without escaping.
- Automatic line folding is off, and a value that appears several times is written out each time instead of using anchors and aliases (
&,*). - An empty array is written
[]and an empty object{}. A top-level scalar such as a string or number converts as well. - Integers beyond 2^53 are rounded when the input is read, so a warning is shown.
Examples
Input:
{"name":"app","ports":[80,443],"owner":{"이름":"홍길동"},"debug":false,"version":"1.0"}
Result:
name: app
ports:
- 80
- 443
owner:
이름: 홍길동
debug: false
version: '1.0'
FAQ
Will converting the YAML back to JSON give the same data?
Structure and values come back the same. Strings that could be read as another type, such as "true" or "123", get quotes so they stay strings. Key order is kept unless you turn on key sorting.
Are long sentences folded across several lines?
No. Line folding is switched off, so a string stays on one line and is never split. A string that contains line breaks may be written as a YAML block scalar.
How are JSON errors reported?
You get the line and column of the first character that breaks the syntax. Things JSON does not allow, such as trailing commas and comments, are reported as errors too.
Are huge integers safe?
The input is read with JavaScript, so integers beyond 9007199254740991 (2^53-1) are rounded. A warning appears when that happens, so wrap such numbers in strings.