YAML to JSON Converter
Convert YAML to JSON and back, with syntax checking.
Updated · Examples checked by automated tests
JSON output
Paste a document on the left.
About YAML to JSON Converter
YAML is the configuration language of Kubernetes, GitHub Actions, Docker Compose and much of modern infrastructure tooling. Its indentation-sensitive syntax is friendly to write and unforgiving to get wrong.
This converter parses YAML into JSON so you can see exactly how a tool will interpret your file, and converts JSON back into readable YAML when you need to move in the other direction.
How YAML to JSON Converter works in your browser
YAML is parsed into a data structure and printed as JSON, so you can see exactly how a tool will interpret indentation, lists and scalars. The reverse direction converts JSON back into readable YAML.
The parser covers the common configuration subset — mappings, sequences, quoted and block scalars, comments and flow collections. Anchors, aliases and custom tags are reported rather than silently mangled, and tab indentation is flagged because it is invalid YAML.
When to use it
- Checking how a Kubernetes or GitHub Actions file will actually be interpreted.
- Finding the indentation error that breaks a Docker Compose file.
- Converting a JSON config into YAML for a tool that expects it.
Worked examples
Convert a small config file to JSON
Settings: YAML to JSON
Input
server:
port: 8080
hosts:
- a.example.com
- b.example.com
debug: falseExpected output
{
"server": {
"port": 8080,
"hosts": [
"a.example.com",
"b.example.com"
]
},
"debug": false
}Mappings become objects and sequences become arrays. Unquoted numbers and booleans become JSON numbers and booleans.
Convert JSON to YAML
Settings: JSON to YAML
Input
{"name":"api","replicas":2,"ports":[80,443]}Expected output
name: api
replicas: 2
ports:
- 80
- 443Each nesting level is indented by two spaces, the convention used by Kubernetes and most CI configuration.
Limits and checks before you use the result
- Anchors, aliases, custom tags and multiple documents in one file are reported as unsupported rather than guessed at.
- Comments are dropped when converting, because JSON has no comments.
- YAML treats unquoted values like yes, no and 1.0 as types in some parsers. Quote values that must stay strings.
Frequently asked questions
How do I convert YAML to JSON?
Paste the YAML and the JSON equivalent appears, which shows exactly how a tool will interpret your indentation. The reverse direction converts JSON back to YAML.
Which YAML features are supported?
The common configuration subset: nested mappings, sequences, scalars, quoted strings, comments, multi-line block scalars and inline flow collections.
Are anchors and aliases supported?
Anchors, aliases and custom tags are not resolved. They are rare in hand-written configuration and are reported rather than silently mangled.
Why does indentation matter so much?
YAML uses indentation for structure, and tab characters are not valid indentation. The converter flags tabs explicitly because they are a very common cause of errors.
Related tools
JSON Formatter
Format, beautify and validate JSON with 2 or 4 space indentation.
JSON Validator
Check whether a JSON document is valid and see exactly where it breaks.
JSON Minifier
Strip whitespace from JSON and see how many bytes you saved.
JWT Decoder
Decode the header and payload of a JSON Web Token and inspect its claims.
UUID Generator
Generate cryptographically random v4 UUIDs in bulk.
Regex Tester
Test regular expressions live with highlighted matches and capture groups.