JSON to YAML & YAML to JSON
JSON and YAML describe the same shapes of data, but different tools insist on different formats. Kubernetes manifests, GitHub Actions workflows, Docker Compose files, and OpenAPI specs are usually written in YAML, while APIs and JavaScript tooling hand you JSON. This converter moves between the two in either direction: paste JSON on the left for YAML on the right, or use the swap button to turn it into a YAML to JSON converter and go the other way.
Everything runs entirely in your browser — nothing you paste is ever sent to a server, so it is safe to convert real config files, including ones with internal hostnames or environment details.
Why does my YAML turn NO into false?
This is the famous "Norway problem." Older YAML parsers follow the YAML 1.1 spec, which
treats y, n, yes, no, on,
and off as booleans — so a list of country codes containing
NO silently becomes false. This converter guards against that
by quoting those values when it writes YAML, so "NO" comes out as
'NO' and survives a round trip as a string. Reading YAML, it follows the
newer YAML 1.2 core schema, where only true and false are
booleans and yes/no stay text.
JSON vs YAML: which should I use?
| JSON | YAML | |
|---|---|---|
| Comments | Not allowed | Supported with # |
| Multi-line strings | Escaped as \n | Block scalars (|, >) |
| Syntax noise | Braces, brackets, commas | Indentation only |
| Whitespace | Insignificant | Significant — indentation is structure |
| Trailing commas | Invalid | Not applicable |
| Best for | APIs, data interchange, machine output | Config files people edit by hand |
As a rule of thumb: YAML when a human maintains the file and comments matter, JSON when a program produces or consumes it.
What YAML features are supported?
Block mappings and sequences, flow collections ([1, 2] and
{a: 1}), plain, single-quoted and double-quoted scalars, literal and folded
block scalars, comments, and anchors and aliases (&name /
*name). Multi-document streams — several documents in one file
separated by ---, which is how multi-resource Kubernetes manifests are often
written — are not supported, and neither are custom tags or complex
mapping keys. If you paste one of those, you get a clear error rather than a silently
mangled result; split the documents and convert them one at a time.
Is the conversion lossless?
Converting JSON to YAML and back returns exactly the data you started with. Going the other way, YAML to JSON, drops things JSON has no way to express: comments disappear, anchors and aliases are expanded into duplicated values, and formatting choices like block scalars become ordinary escaped strings. That is inherent to JSON, not a limitation of this tool — keep the YAML file as your source of truth if the comments matter.
How do I check my JSON is valid first?
If the converter reports invalid JSON, run it through the JSON Formatter & Minifier, which pretty-prints and validates it and points at the first syntax error. To turn a plain string into an escaped JSON value, use JSON Stringify Text, and to build JSON from spreadsheet data, try the CSV to JSON Converter.
Last reviewed: August 2026