How to convert JSON to YAML
- 01Add JSON filesChoose files or drop them on the page.
- 02Converted on your deviceNothing is uploaded. Adjust settings if you like.
- 03DownloadSave each file, or all of them as one ZIP.
With this JSON to YAML converter you get a file people can read and edit by hand: a Kubernetes manifest, a Docker Compose or GitHub Actions file, an Ansible variable file or an OpenAPI spec. The structure and every value stay the same; only the notation changes, and nothing leaves your browser.
JSON to YAML: before and after
Input: {"service": {"name": "web", "ports": [80, 443], "env": {"DEBUG": false}}}. Output: a service: line, then name: web, ports: followed by - 80 and - 443 as list items, and env: with DEBUG: false underneath, each level indented by two spaces.
Braces, brackets, commas and most quotes disappear. A list of objects becomes a list whose items start with a dash, so a containers array turns into - name: app followed by image: nginx lined up beneath it.
Why some strings get quotes
Some values are strings in JSON but would mean something else if written bare in YAML. The converter wraps those in single quotes so they read back as the same strings:
- Words that a YAML reader could take as booleans: "yes", "no", "on", "off", "true", even single-letter keys like y and n, which older YAML 1.1 readers treat as booleans.
- Strings that look like numbers or dates, such as "123", "1.10" or "2024-01-15".
- Strings starting with # or containing a colon followed by a space, which would otherwise start a comment or a new key.
- Empty strings, written as ''.
Long and multi-line text
Long strings stay on one line. They aren’t folded at a fixed width, so URLs, keys and long commands come out exactly as they were.
A string with line breaks becomes a literal block that starts with |, keeping every line break as it was. That’s much easier to read than \n escapes, and it’s the usual way to store embedded scripts, certificates or long descriptions in YAML.
What stays the same
- Numbers, true, false and null keep their types. null is written as null.
- Keys keep the order they had in the JSON, apart from keys that are plain numbers, which JavaScript always lists first.
- Empty objects and lists are written as {} and [].
- No --- document marker, comments or anchors are added. Indentation is always two spaces, the most common style in config files; the page has no settings to change.
Problems and related tools
Invalid JSON is rejected with the line and column of the problem, often a trailing comma or a missing quote. Running the YAML through YAML to JSON gives back the same data, which is a quick way to check a round trip. For tagged data rather than config, use JSON to XML.
At a glance
- Price
- Free. No sign-up, no watermark.
- Privacy
- Files are processed in your browser and never uploaded.
- Accepts
- JSON
- You get
- YAML
- Batch
- Convert many files at once and download them as a ZIP
- Works in
- Chrome, Edge, Firefox and Safari, on phones and computers
- Offline
- After the first conversion, it keeps working without internet
Questions
Are my files uploaded?
Never. JSON to YAML conversion runs in your browser, so your files stay on your device.
Can I convert many at once?
Yes. Add as many as you like and download them all as one ZIP.
Is there a size limit?
Files of tens of megabytes are fine on most computers.
Why are some values in single quotes?
They are strings that would otherwise be read as a boolean, number, date or comment. The quotes keep them as the same strings.
Can I choose four-space indentation?
No. The output always uses two spaces. Most code editors can re-indent a YAML file if your project uses four.
Will the YAML convert back to the same JSON?
Yes. Structure, types and values are preserved, so YAML to JSON returns the same data. Only spacing can differ.