Skip to content

Convert YAML and JSON

Paste YAML to get JSON, or JSON to get YAML: the text decides the direction, not you. The result updates as you type and never leaves your device.

Your text stays on your device: nothing is uploaded

0 characters

Comments and the original punctuation do not survive the conversion: the values do.

Result

Paste something on the left: the result appears as you type.

How it works

“no”, “on” and “off” stay words, and a date stays the string you wrote: they do not silently become true, false or numbers. Anchors and merges are expanded, because in JSON they would mean nothing. The other way round, quotes go where they are needed, so a postcode like 01234 comes back identical. Anything JSON cannot represent stops the conversion and names the exact line, instead of being converted at random. Comments do not carry over: they do not exist in JSON.

Frequently asked questions

Why does the postcode 06121 turn into 6121 in the JSON?
Because in YAML an unquoted 06121 is a number, and leading zeros on a number don’t count. Put it in quotes, "06121", and it stays text. The same goes for very long codes: past fifteen digits a whole number can lose its last ones, and we flag it under the result.
My file has several documents separated by “---”. What happens?
They become a JSON list, one item per document, in the same order, and the note under the result says how many there were. The other way round, a JSON list becomes a single YAML document: if you need them separate, split them by hand.
I pasted JSON and the error talks about YAML. Why?
Because the text isn’t valid JSON, so it gets read as YAML. Often YAML accepts it anyway and clean JSON comes out: that happens with trailing commas, single quotes, unquoted keys and // comments. If an error does appear, the line and column show where reading stopped; for a strict JSON check, use “Format JSON”.
How do I compare two configs written in a different order?
Turn on “Sort keys alphabetically” and convert the two texts one after the other: the keys come out in the same order in both, whichever way you convert. Then paste the two results into “Compare texts”, and only the real differences are left. Lists are never reordered.

What you paste is never uploaded. Anywhere.

The text you type stays in your browser’s memory: no request goes out while you type. You can paste something confidential.

  • Processed locallyEverything happens on this page.
  • Nothing to upload, nothing to wait forNothing to upload, no waiting.
  • Nothing to deleteWe keep nothing: nothing reaches us.
YOUR DEVICEyour fileprocessingthe resultservernever gets here

Other tools in this category