Free Online JSON to YAML Converter
Convert JSON to YAML or YAML to JSON in both directions.
About the JSON to YAML Converter
JSON and YAML describe the same kinds of data: objects, arrays, strings, numbers, booleans, and null. JSON is strict and compact, which makes it ideal for APIs and machine-to-machine communication. YAML is indentation-based and much easier for humans to read and edit, which is why it is popular for configuration files, CI pipelines, Kubernetes manifests, and documentation. This converter translates between the two formats in both directions using the js-yaml library.
Important differences
- Keys: JSON keys must be quoted strings. YAML keys are usually plain text but can be quoted.
- Indentation: YAML uses spaces, never tabs, to express nesting. Misaligned indentation is the most common YAML error.
- Comments: YAML supports
#comments, but JSON does not. Comments are lost when converting to JSON. - Anchors and aliases: YAML can reuse values with anchors. They are expanded into ordinary values when converted to JSON.
- Scalars: YAML may interpret unquoted words such as
yes,no, oronas booleans, so quote values when the string form matters.
The converter validates input before writing output. If the JSON parser or YAML loader reports an error, the message includes the line and column where possible, and the output is left untouched. Everything runs locally in your browser, so configuration files and test fixtures are not uploaded to a server.
How to use this tool
- Paste JSON on the left or YAML on the right.
- Watch the status badge to confirm the input parses correctly.
- Click JSON to YAML or YAML to JSON.
- Copy or download whichever side you need.
Frequently asked questions
Can I convert a JSON array to YAML?
Yes. A top-level array becomes a YAML sequence. Objects, nested arrays, numbers, and booleans keep their types.
Why did my YAML fail to load?
Common causes are tab indentation, inconsistent spacing, duplicate keys, or a colon followed by a missing value. The error badge reports the location so you can fix it.
Are comments preserved?
No. JSON has no comment syntax, and js-yaml does not retain comments when loading. Keep the original YAML if comments matter.