YAML ⇔ JSON mutual conversion tool (hierarchical structure maintained) | ZeroTools

A web utility to convert YAML strings and JSON code bidirectionally. Specify the source and destination with the "Switch direction" button, and the input text is parsed using the browser's JavaScript environment. The result can be copied to the clipboard.

Loading tool interface...

When to use this tool

Back to the tool ↑

Convert between one YAML document and JSON and inspect the resulting objects and arrays.

Try it first

Enter an items list with one object containing name: tea and quantity: 2. Check that both properties appear in the JSON.

Before you start

Input is limited to 100,000 UTF-16 code units. Quote identifiers with leading zeros to keep them as text.

Local Browser Processing and Network Communication Notice

This tool's processing operates locally within your browser. Standard site assets, analytics, and advertisements may communicate separately. There are no guarantees.

ZeroTools: Browser Processing & Privacy

ZeroTools focuses on tools that process input on your device. Check each tool’s scope and limitations before use.

Processing and privacy policy
Chapter 1

What the conversion preserves

Use YAML to JSON for a single YAML document or switch direction to turn JSON into YAML. Nested objects, lists and JSON-compatible values keep their structure and types.

For example, the YAML below produces an items array containing one object with name “tea” and quantity 2.

Enter items: on the first line, an indented - name: tea on the next, and a quantity: 2 property aligned with name. Both properties should appear in the JSON.

Chapter 2

Strings, comments and references

Quote identifiers such as "00123" to preserve their text. YAML comments are omitted, while a hash inside a quoted string stays in the string.

The converter expands aliases in JSON and rejects circular references. JSON numbers use JavaScript numeric precision, so quote identifiers with very large digits.

Chapter 3

Limits and errors

Use one YAML document per conversion. Input is limited to 100,000 UTF-16 code units, 50 levels of nesting, 50,000 expanded values and 1,000,000 UTF-16 code units of output.

A failed conversion clears the result. Review the converted file against the requirements of the application that will use it.

Frequently Asked Questions (FAQ)

A.
YAML comments are omitted from the JSON output. A hash inside a quoted string stays part of that string.
A.
Input is limited to 100,000 UTF-16 code units, 50 levels of nesting and 50,000 expanded values. Output is limited to 1,000,000 UTF-16 code units.
A.
Convert one YAML document at a time. Split multi-document input before converting.
A.
Because it is parsed once as a JavaScript number in the browser, extremely large integers (like values exceeding Number.MAX_SAFE_INTEGER) may lose precision as lower digits are rounded. We recommend defining huge numeric identifiers as strings in the source JSON data.