UUID Studio

JSON to YAML

Turn JSON into readable YAML.

  • 🔒 No data stored or uploaded
  • âš¡ 100% client-side
  • 🆓 Free, no account

Need more than one tool at a time? Open the full Workbench - or press Ctrl+K to jump to any tool.

Create or edit JSON here (syntax colors), then format, validate, or convert - same as MongoDB $binary UUID blobs on the Convert tab once detected.

New document

About JSON to YAML

YAML is a superset of JSON, so any JSON document is already valid YAML - the conversion is really a re-formatting into the indentation-based style people actually want to read and edit.

The reason to convert is legibility and comments. Kubernetes manifests, CI pipelines, Docker Compose files and Ansible playbooks are all YAML because a human edits them, and YAML supports comments while JSON does not. Round-tripping through JSON therefore destroys every comment in the file, which is worth knowing before you convert a config file and convert it back.

YAML's implicit typing is the thing that bites. In YAML 1.1 - which many parsers, including older PyYAML and Go's yaml.v2, still follow - the unquoted words yes, no, on, off, y and n become booleans, so a country code of NO becomes false and a config key of on becomes true. Version strings like 1.10 become the number 1.1, and a MAC address or time-like value such as 22:30 can parse as a sexagesimal integer. This is known as the Norway problem, and the fix is to quote any string that could be mistaken for something else.

This runs in your browser, so a real payload is never uploaded - which matters when the document you are converting is a production API response rather than a toy example.

How to use the JSON to YAML

  1. Paste the JSON. If it does not parse, fix that first - the error will name the position.
  2. Convert, and read the YAML output.
  3. Check the specific cases listed below before relying on the result - YAML and JSON do not model data identically.
  4. Copy the output, or convert back to confirm the round trip does what you expect.

Examples

  • JSON config
    {"service":"api","port":8080,"replicas":3}

When you need this

  • Turning an API response into YAML for a config file, a spreadsheet, or a type definition.
  • Producing a YAML fixture from real data rather than writing it by hand.
  • Checking how a nested structure maps into YAML before committing to it.
  • Converting a sample from documentation into the form your tooling needs.

Common problems and what causes them

The Norway problem: NO becomes false
YAML 1.1 treats yes, no, on, off, y and n as booleans, so an unquoted country code NO parses as false and a key named on parses as true. YAML 1.2 narrowed this to true/false only, but many parsers still implement 1.1. Quote any string that could be read as a boolean.
Version numbers losing a digit
An unquoted 1.10 is a float and becomes 1.1. Likewise 1.20 becomes 1.2. Always quote version strings - "1.10" - or they silently change meaning.
Leading zeros and sexagesimal values
Unquoted 0755 may be read as octal, and a value like 22:30 can parse as a base-60 integer in YAML 1.1. File modes, phone numbers, and anything with a colon should be quoted.
Comments destroyed by a round trip
JSON has no comments, so converting YAML to JSON and back removes every one of them, along with anchors, aliases and the original key order. Never round-trip a config file you care about through JSON.
Tabs used for indentation
YAML forbids tabs as indentation entirely - the error message is usually unhelpful about it. Use spaces, and configure your editor to convert them for .yaml files.
Duplicate keys silently accepted
Many YAML parsers accept a duplicate key and keep the last value rather than erroring. In a long manifest this hides a real mistake, so lint for it.

FAQ

Is JSON valid YAML?
Yes - YAML 1.2 is a strict superset of JSON, so any JSON document can be parsed by a YAML parser. The reverse is not true, because YAML has anchors, comments, multiple documents and multi-line scalars that JSON cannot express.
Why did my YAML value NO turn into false?
YAML 1.1 treats no, yes, on, off, y and n as booleans, and many parsers still follow it. A country code of NO, a key named on, or an answer of y all change type. Quote them.
Why did 1.10 become 1.1?
Unquoted, it is parsed as a float, and the trailing zero is not significant in a number. Quote version strings to keep them as strings.
Will converting preserve my comments?
No. JSON has no comment syntax, so comments are lost the moment a YAML document becomes JSON, and cannot be recovered on the way back. Edit YAML as YAML when comments matter.
Is my data uploaded when I convert it here?
No. The conversion runs entirely in your browser with no network request, so pasting a real payload does not transmit it. The page works offline once loaded.
Does it support anchors?
Output is plain YAML without custom anchors or tags.

Related reading