JSON to YAML
Convert JSON to YAML and YAML back to JSON, in both directions, with your choice of indentation.
Direction
Converted live as you type. Nothing leaves your browser.
Indentation
YAML
How to convert JSON to YAML online
Pick a direction
Choose JSON to YAML or YAML to JSON. The input and output labels switch to match.
Paste your document
Drop JSON or YAML into the input. The converted result appears live as you type, with parser errors shown inline.
Set the indentation
Choose 2 or 4 spaces. The setting applies to YAML nesting and to pretty-printed JSON alike.
Copy the output
Click the Copy YAML or Copy JSON button to take the result to your editor.
Why use this tool
Two directions, one tool
The same page converts JSON to YAML and YAML back to JSON, so round-tripping a config takes a click, not a second tab.
Real YAML parser
Anchors and aliases in YAML input are resolved into their referenced values, not treated as plain text.
No forced line wrapping
YAML output is generated with wrapping disabled, so long strings and URLs stay on one line instead of being folded.
Indentation choice
2 or 4 spaces, applied to both YAML block nesting and JSON pretty-printing.
Inline parser errors
Invalid input shows the parser's own error message and clears the moment the document parses again.
Configs stay local
Everything runs in your browser, so pipeline files and manifests naming internal hosts or credentials never leave your machine.
About this tool
This converter translates between JSON and YAML in either direction, entirely in your browser. JSON input is dumped as YAML with line wrapping disabled; YAML input is parsed, with anchors and aliases resolved, and printed as indented JSON. Both directions honour the 2 or 4 space indentation setting, and the output regenerates live as you type.
The traffic between these two formats is mostly configuration. Kubernetes manifests, GitHub Actions workflows, docker-compose files, and OpenAPI specs are written in YAML, while the APIs and tooling around them tend to emit or expect JSON. Turning a JSON API response into a YAML manifest snippet, or flattening a YAML file into JSON so a script can consume it, is a routine chore in that world.
Those files are often sensitive: they name internal services, ports, and occasionally credentials that should not be pasted into a random website. Here the conversion never leaves your browser. Before converting, the JSON formatter can validate and tidy JSON input; the values inside a Kubernetes Secret can be encoded and decoded with the Base64 tool; and cron expressions found in CI YAML can be read with the cron parser.
Frequently asked questions
- Does this convert in both directions?
- Yes. Switch the direction between JSON to YAML and YAML to JSON. The input and output labels update to match, and the result regenerates instantly as you type.
- Is my data uploaded anywhere?
- No. The conversion runs entirely in your browser. Your data never leaves your device, is never sent to a server, and is not stored or logged.
- Can I control the indentation?
- Yes. Choose 2 or 4 spaces of indentation. This applies to the nesting in YAML output and to the pretty-printed JSON output.
- What happens if my JSON or YAML is invalid?
- The tool shows an inline error with the parser message instead of crashing, and clears it the moment the input becomes valid again. Empty input shows a neutral empty state.
- Does it support comments and anchors?
- YAML comments are not preserved because JSON has no equivalent, so a round trip through JSON drops them. Standard YAML anchors and aliases are resolved into their referenced values when converting YAML to JSON.
Related tools
JSON Formatter & Validator
Pretty-print, minify, or explore JSON as a collapsible tree, with syntax errors shown inline.
Base64 Encode & Decode
Encode text, files, and images to Base64, decode it back, and get a ready-to-use data URI.
Cron Expression Parser
Translate a cron expression into plain English and preview its next scheduled run times.
Angle Converter
Convert an angle between degrees, radians, gradians, turns, arcminutes and arcseconds, with a degrees-minutes-seconds breakdown.
Area Converter
Convert area between metric and imperial units instantly.
Binary to Decimal Converter
Convert a binary number to its decimal value, with hexadecimal and octal readouts.