Skip to main content
WizTools123
Free Online Tools

Tool Categories


Developer Tools New Tool

Free Online YAML to JSON and JSON to YAML Converter

Turn YAML into JSON or JSON into YAML, with the indent, line width, quoting style and flow level in your hands. A file holding several documents can come out as the first one or as an array of all of them, and a mistake is reported with its line and column.

YAML And JSON Both Ways Multi-Document Files Indent And Quoting Control Nothing Uploaded
Free Online YAML to JSON and JSON to YAML Converter
Share this tool
JSON & YAML Converter Everything happens in this tab. Nothing you paste is sent anywhere.
Your document
Result
Direction
Writing the JSON
Writing the YAML

Converted.

1 documents in 0 keys 0 levels deep 0 bytes out

Comments are not carried across in either direction. JSON has no comment syntax, and a YAML parser does not keep them, so keep your original if the comments matter.

Buy Us A Coffee

Enjoying WizTools123? Help keep our server infrastructure 100% free and open for everyone.

Buy Us A Coffee

How to Use JSON and YAML Converter

Step by step, start to finish.

1
Paste YAML or JSON

Press Sample to load an example for the direction you are in. It converts as you type and nothing is uploaded.

2
Pick the direction

YAML to JSON, or JSON to YAML. The options change, because each direction needs different questions answered.

3
Set the output

Going to JSON: how many documents to take and the indent. Going to YAML: indent, line width, quoting, sorting and flow level.

4
Check the notes

Anything that changed shape, such as a timestamp becoming a string, is reported above the counts. Then copy or download.

Key Features

What this tool does, and what it does not do.

Both directions

YAML to JSON and JSON to YAML, each with its own options.

Multi-document files

A file split on --- gives you the first document or an array of all.

Output you control

Indent, line width, quoting style, sorted keys and flow level.

Errors with a position

A line and a column from either parser, not a vague complaint.

Says what changed

Timestamps, anchors and byte strings are counted and reported.

Nothing uploaded

Manifests hold hostnames and tokens. Parsing happens in your tab.

About JSON and YAML Converter

JSON and YAML hold nearly all the configuration in modern infrastructure. Kubernetes, GitHub Actions, Docker Compose and Ansible lean on YAML because humans have to read and edit it; APIs, build tools and package manifests lean on JSON because machines have to parse it unambiguously. Converting between them comes up whenever a file has to cross that line.

This page does both directions with js-yaml in your browser. Going to JSON you choose whether a multi-document file becomes its first document or an array of all of them, and what the layout should be. Going to YAML you get the indent, the wrap width, the quoting style, sorted keys and the depth at which it switches to inline braces. Either way a syntax error comes back with the line and the column it was found on.

The part worth being careful about is the direction that loses something. JSON going to YAML is straightforward, because YAML can express everything JSON can. YAML going to JSON needs a few decisions, because dates, anchors, binary values and multiple documents have no direct JSON equivalent. Rather than convert silently, the page counts those cases and tells you what it did, so a date quietly becoming a string is something you find out here instead of downstream.

Frequently Asked Questions

Common questions about this tool.

Often not. YAML 1.2 is a superset of JSON, so a valid JSON document is already valid YAML and most tools will accept it unchanged. The reason to convert is human: YAML with block style is far easier to read, to comment and to review in a diff. If your only problem is that a tool says it wants YAML, try pasting the JSON first.

YAML has a real timestamp type, so 2024-03-11 is parsed as a date rather than as text. JSON has no date type, so it is written as an ISO 8601 string. That is the standard way to carry a date in JSON and most consumers understand it, but be aware it is now a string and will come back as a string if you convert in the other direction.

JSON has no way to refer to a value defined elsewhere, so anchors are expanded: the block they pointed at is written out in full at every place it was used. The data is identical, but the sharing is gone and the file is longer. If you convert back to YAML afterwards you will get the repeated blocks, not the anchors.

A JSON file can only hold one value, so you choose. Take the first document, which is what most single-document loaders do, or produce an array containing every document in order. The count of documents found is shown above the result either way, so you notice when a file has more in it than you expected.

No. The parsing is done by js-yaml loaded from this site, and the conversion happens in your browser with no request to any server. That matters because YAML manifests routinely contain hostnames, image registries, environment variables and sometimes secrets. You can verify it in the Network tab.

More Developer Tools

Other tools from the same hub, free and in your browser.

All Developer Tools

Feedback

No feedback on this tool yet. Yours would be the first.