glunty

JSON to YAML Converter

Two-way JSON and YAML conversion. Configurable indent, inline errors. Local only.

Direction:

What this tool does

Converts structured data between JSON and YAML in both directions. In JSON to YAML mode it parses your JSON with the browser's built-in parser and serializes the result as YAML with the indent you pick. In YAML to JSON mode it parses the YAML with a vendored copy of the js-yaml library and prints pretty JSON with 2 space indentation. Invalid input never crashes the page: you get an inline error message with the reason instead. Everything runs locally, so nothing you paste leaves your machine.

How to use it

Pick a direction. For JSON to YAML, paste JSON on the input (left) side, choose 2 or 4 space indentation, and read the YAML on the output (right) side. For YAML to JSON, paste YAML and get JSON back. Conversion runs as you type and also on demand with the Convert button. Use Copy result to grab the output.

Example: paste {"a":1,"b":["x","y"]} in JSON to YAML mode and you get:

a: 1
b:
  - x
  - y

Switch to YAML to JSON, paste that YAML back, and you get an equivalent JSON object again. The round trip is lossless for plain data made of objects, arrays, strings, numbers, booleans, and null.

Common use cases

  • Turning a JSON API response or config into YAML for a Kubernetes, Docker Compose, or CI file.
  • Converting a YAML config into JSON so a program that only reads JSON can consume it.
  • Reindenting a YAML file to a consistent 2 or 4 space style by round-tripping it.
  • Reading a dense JSON blob as YAML because the block layout is easier on the eyes.
  • Sanity-checking that a YAML file parses at all before you commit it.

Common pitfalls

  • Whitespace is significant. YAML uses indentation to express nesting, so a stray extra space can change the structure or cause a parse error. When something looks wrong, check the leading spaces first.
  • Tabs are not allowed for indentation. YAML rejects the tab character where it expects indentation. Use spaces. If a paste fails with an indentation error, a leading tab is the usual culprit.
  • The Norway problem. Unquoted no, yes, on, and off can be read as booleans by many YAML parsers, so the country code NO may become false. Quote values you want to stay as text.
  • Comments do not survive the trip to JSON. JSON has no comment syntax, so YAML comments, anchors, and aliases are dropped or expanded when you convert to JSON.
  • Types are inferred. An unquoted 1.10 parses as the number 1.1, and an unquoted date-like token can become a timestamp. Quote such values if you need them treated as plain strings.

Frequently asked questions

Is every JSON document also valid YAML?
Mostly yes. YAML 1.2 is defined as a superset of JSON, so a well-formed JSON document is also a valid YAML document, and this converter accepts it in either direction. The reverse is not true: YAML has features with no JSON equivalent, such as comments, anchors and aliases, and multi-document streams, so converting YAML to JSON can drop or flatten those constructs.
Does converting YAML to JSON keep my comments?
No. JSON has no syntax for comments, so any YAML comment that starts with a hash is discarded when you convert to JSON. YAML anchors and aliases are likewise expanded into plain values. If you need to keep comments, keep the YAML copy as the source of truth and treat the JSON as a generated artifact.
Why do the words no, yes, on, and off sometimes become true or false?
This is the so-called Norway problem. In YAML 1.1 and in many YAML libraries, the bare words yes, no, on, off, true, and false are all read as booleans, so the country code NO can silently become the boolean false. To keep such a value as text, wrap it in quotes. Numeric-looking strings such as a version number like 1.10 have the same risk and should also be quoted.
Why does YAML reject my tab characters?
YAML forbids the tab character for indentation. Structure in YAML is defined by leading spaces, and a tab where the parser expects indentation is a syntax error. If a paste fails with an indentation complaint, replace leading tabs with spaces. Two spaces per level is the common convention and the default this tool uses when it writes YAML.
What indentation options are there, and do they change the data?
When converting JSON to YAML you can choose 2 or 4 spaces of indentation. Indentation in YAML is significant for structure, but the number of spaces per level is a style choice, so 2 and 4 produce the same data laid out differently. Converting YAML to JSON always uses a 2 space pretty-printed layout.
Is the data I paste uploaded anywhere?
No. Both directions run entirely in your browser using a vendored YAML library and the built-in JSON parser. Nothing is sent to a server, so you can paste private config or secrets without them leaving your machine. You can confirm this in DevTools under the Network tab, where you will see zero requests during a conversion.

Embed this tool

Free for any use; attribution appreciated. Paste this on your site:

The embed runs the same tool that lives at this URL. No tracking; no ads inside the embed. Resize height as needed for your layout.

Cite this tool

For academic, journalistic, or technical references. Pick a format:

Citations use 2026 as the publication year. Access date is left as a fillable placeholder where the citation style expects one.

Embedded tool from glunty.com