ToolJutsu
All tools
Developer Tools

JSON to YAML

Convert JSON into readable YAML.

0 B
Tip: press Ctrl/ + Enter
Processed on your device. We never see your files.

How to use JSON to YAML

What this tool does

This tool takes JSON and rewrites it as YAML. JSON and YAML model the same data — objects, arrays, strings, numbers, booleans and null — but JSON leans on braces, brackets and quotes, while YAML uses indentation and is far easier for a person to read and edit. The converter parses your JSON, then serialises the resulting data structure as clean YAML with the indentation you pick. The whole process runs in your browser, so nothing you paste is ever uploaded.

Why you might need it

JSON is the lingua franca of APIs, but YAML is what people actually maintain by hand. You might have an API response, a package.json fragment or a generated config blob in JSON and need it as YAML for a CI pipeline, a Kubernetes manifest, a Docker Compose file or an application settings file. YAML’s lack of punctuation noise also makes it the better format for anything a human will read regularly — turning a dense JSON object into indented YAML often makes its structure obvious at a glance. Converting is also handy when you want to comment a config: YAML supports comments, JSON does not.

How to use it

  1. Paste your JSON into the input box, or drop a .json file onto it.
  2. Choose the YAML indentation: 2 spaces or 4 spaces.
  3. Click Convert to YAML, or press Ctrl/Cmd + Enter.
  4. The YAML appears below; use the copy button to grab it.
  5. If the JSON is malformed, a clear error names where parsing failed.

Use the Load sample button to see a conversion straight away, and watch the byte counters to compare the size of the two formats.

Common pitfalls

The most common error is JSON that is not quite valid. JSON is stricter than the object syntax you write in JavaScript: every key must be in double quotes, strings cannot use single quotes, there can be no trailing comma after the last element, and comments are not allowed. A snippet copied from source code often trips on one of these. The error message gives you a line and column to start from.

On the YAML side, be aware that some string values get quoted automatically in the output. The serialiser quotes any value that would otherwise be misread — a string like yes, null, 12345 or one starting with a special character is wrapped in quotes so it stays a string when the YAML is parsed back. That is correct behaviour, not a bug: it guarantees the YAML round-trips to the same data.

Tips and advanced use

YAML output is excellent for code review. Convert a large JSON config to YAML before committing it and the diff becomes line-oriented and readable, with one key per line instead of a wall of braces. If you maintain the same configuration in both formats, convert in one direction here and keep the result as the source of truth to avoid drift. The converter keeps long strings on a single line, which means values like URLs or tokens never get folded across lines — convenient when you need to copy them. And because everything runs locally, converting JSON that contains credentials or private data is completely safe; none of it leaves your device.

Frequently asked questions

Is my JSON sent to a server?
No. The JSON is parsed and dumped as YAML entirely inside your browser using JavaScript. Nothing is uploaded, so it is safe to convert payloads that contain tokens, customer data or internal identifiers.
Why does my JSON show as invalid?
JSON is stricter than a JavaScript object: keys and strings need double quotes, trailing commas are not allowed, and comments are forbidden. The error message points to the line and column where parsing first failed.
Will the YAML output keep my key order?
Yes. Object keys are emitted in the same order they appear in the JSON. The data, types and nesting are all preserved exactly — only the syntax changes from brackets and quotes to indentation.
Why are some long lines not wrapped?
The converter sets an unlimited line width on purpose, so long strings stay on a single line instead of being folded. This keeps the YAML easy to copy and diff without surprise line breaks inside values.
Can I convert an array at the top level?
Yes. A top-level array becomes a YAML sequence with one dash-prefixed item per element. Any valid JSON value works as the root, including a single string, number or boolean.

Related tools