JSON to YAML Converter (and YAML to JSON)
Convert JSON to YAML and YAML back to JSON with live output, selectable indentation, and parse errors that point to the failing line.
Two-way converter between JSON and YAML. Paste either format and the other appears as you type: JSON is parsed and dumped as clean YAML, YAML is loaded and serialized as indented JSON. Pick 2-space or 4-space indentation, swap direction to feed the output back in, and copy or download the result as a .yaml or .json file.
JSON and YAML describe the same data structures (maps, lists, strings, numbers, booleans, null) with different syntax, so most configuration travels between them at some point: a Kubernetes manifest you want to inspect as JSON, an API response you want to drop into a docker-compose file, an OpenAPI spec maintained in one format but consumed in the other. Converting by hand invites indentation mistakes and missing quotes; this tool does the round trip mechanically using the same js-yaml parser that powers much of the Node ecosystem.
Conversion happens live as you type. In JSON to YAML mode the input is parsed with JSON.parse and dumped as block-style YAML with your chosen indent (2 or 4 spaces), without anchors or aliases, and with key order preserved. In YAML to JSON mode the document is loaded and re-serialized with JSON.stringify at the same indent. If parsing fails, the error message names the problem and, where the parser reports it, the exact line and column, so you can fix a stray tab or unclosed bracket instead of guessing.
The swap button reverses direction and feeds the current output back in as input, which makes it easy to verify a conversion survives the round trip. Multi-document YAML streams (documents separated by ---) are rejected with an explanation rather than silently truncated: split them and convert each document on its own.
- 1
Pick a direction
Choose JSON to YAML or YAML to JSON from the tabs, and set the output indentation to 2 or 4 spaces. The indent choice is remembered for next time.
- 2
Paste your document
Drop JSON or YAML into the input panel. The converted output renders on the right as you type; syntax errors appear below with the line and column where parsing failed.
- 3
Copy, download, or swap
Copy the result to the clipboard, download it as a .yaml or .json file, or hit swap to reverse direction and round-trip the output for verification.
Editing Kubernetes and CI manifests
Turn a kubectl get -o json dump into readable YAML before committing it, or convert a workflow file to JSON for scripting with jq.
Moving config between toolchains
Convert a package config or API response from JSON into YAML for docker-compose, Ansible, or Home Assistant files that expect YAML.
Translating OpenAPI and Swagger specs
Maintain an API spec in YAML for easier diffs, then export the JSON version that some generators and validators require.
Debugging YAML by eye
Convert a YAML file with tricky indentation to JSON, where the brackets make nesting explicit, to confirm the structure is what you intended.
Does the converted file stay on my machine?
Yes. Parsing and serialization run entirely in your browser with the js-yaml library; nothing you paste is uploaded or sent to a server, and the tool keeps working offline once the page has loaded.
Why is multi-document YAML rejected?
A YAML stream with --- separators contains several independent documents, but a single JSON value can only represent one of them. Rather than silently dropping documents, the tool reports the situation and asks you to convert each document separately.
Will my key order and comments survive the conversion?
Key order is preserved in both directions. Comments are not: JSON has no comment syntax, and YAML comments are discarded by the parser before serialization, so a YAML to JSON to YAML round trip loses them.
How are YAML anchors and aliases handled?
When converting YAML to JSON, anchors and aliases are resolved, so aliased values appear as full copies in the JSON. When converting JSON to YAML, the output never emits anchors (noRefs is enabled), even for repeated objects.
What happens to special YAML values like dates and octal numbers?
The parser follows YAML 1.2 core schema rules: unquoted timestamps become strings, on and off stay strings, and true/false/null map to their JSON equivalents. Numbers keep their numeric type, so 0o14 style octals are converted to plain decimal integers.