YAML ↔ JSON converter
Convert YAML to JSON and JSON to YAML, with the line and column of any error.
How to use
Choose YAML → JSON or JSON → YAML and paste the text: the result appears as you type. Swap puts the result back in the box and flips the direction, so a round trip takes one click. Indentation sets 2 or 4 spaces in the result.
YAML is read with the core schema of YAML 1.2, the current version of the language. Only true and false are booleans, null and ~ are null, and dates stay text. Words such as yes, no, on and off were booleans in YAML 1.1 and still are for some older tools; here they stay text, and JSON → YAML writes them in quotes so those tools read them as text too.
Anchors and aliases (&name and *name) and merge keys (<<) are written out in full, because JSON has no references. Comments are dropped: the YAML specification treats them as presentation, not data. A file with several documents separated by --- becomes one JSON list, with one item per document.
When the input is not valid, the tool gives the line and column of the problem, with the line shown and a caret under the spot. Everything runs in your browser with the open-source js-yaml library, and nothing is uploaded.
Example
“production” takes the keys of “defaults” through <<, keeps its own retries: 5, and off stays the text "off", as YAML 1.2 says.
debug: off → {"debug": "off"}In YAML 1.2, off is text, not false.<<: *defaultsCopies the keys of the anchored mapping; keys written next to it win.a: 1, then ---, then b: 2Two documents become the list [{"a": 1}, {"b": 2}].{"a": 1,}Invalid JSON at line 1, column 8: JSON does not allow a comma before }.
Frequently asked questions
Is my file uploaded?
No. The conversion runs in your browser and nothing is sent anywhere, so configuration files with internal names or addresses stay on your device.
Why did yes or on not become true?
YAML 1.2 keeps only true and false as booleans. Yes, no, on and off are booleans only in the older YAML 1.1, so here they stay text. If you need a boolean, write true or false.
Where did my comments go?
JSON has no comments, and the YAML specification says comments are not part of the data. They are lost on the way to JSON and cannot come back when converting to YAML again.
Why did a long number change?
JavaScript stores JSON numbers as 64-bit floating point, so whole numbers above 9,007,199,254,740,991 lose their last digits. Keep long IDs in quotes so they stay text.
What does “unknown tag” mean?
The YAML uses a custom tag such as !Ref or !GetAtt from AWS CloudFormation, which only that tool understands. Write the long form instead (Ref: or Fn::GetAtt:) and convert again.