When YAML needs to become JSON
YAML is the language of configuration: Kubernetes, Docker Compose, GitHub Actions, OpenAPI specs and countless app settings. It is pleasant to write, but indentation mistakes are easy to make and many tools, validators and APIs only accept JSON.
This converter parses YAML with the yaml library using the YAML 1.2 specification, resolves anchors and aliases, and writes indented JSON. If the file contains several documents separated by ---, you get a JSON array with one element per document.
YAML vs JSON at a glance
| Feature | YAML | JSON |
|---|---|---|
| Full name | YAML Ain't Markup Language | JavaScript Object Notation |
| Type | Hierarchical data | Hierarchical data |
| Introduced | 2001 | Early 2000s (RFC 4627 in 2006) |
| Created by | Clark Evans, Ingy döt Net and Oren Ben-Kiki | Douglas Crockford; now ECMA-404 and RFC 8259 |
| Structure | Maps and lists nested by indentation | Nested objects and arrays |
| Comments | Yes, with # | No |
| Data types | Strings, numbers, booleans, null, dates, lists, maps | String, number, boolean, null, object, array |
| Best for | Config files for Kubernetes, CI pipelines and Docker Compose | APIs, web apps and app settings |
| Support | Most languages through libraries | Every programming language |
| MIME type | application/yaml | application/json |
How to convert YAML to JSON
Step 1: Select a .yaml or .yml file
Drop the config or spec file onto the converter.
Step 2: Keep JSON as the target
JSON is preselected.
Step 3: Convert
The YAML is parsed; syntax errors are reported with a message instead of producing broken output.
Step 4: Download the JSON
Use it with validators, APIs or JavaScript code.
YAML features supported
Multiple documents
Files with --- separators become a JSON array.
Anchors and aliases
&anchor and *alias references are expanded into full values.
YAML 1.2 types
Values like yes, no and on stay strings, avoiding the classic YAML 1.1 surprises.
.yml and .yaml
Both extensions are recognized.
Common YAML to JSON conversions
OpenAPI and Swagger. Some tools only import the JSON form of an API spec.
Kubernetes debugging. Inspect manifests with JSON tools such as jq.
Schema validation. JSON Schema validators usually expect JSON input.
App configuration. Load settings in environments without a YAML parser.
What is lost in translation
JSON has no comments, so YAML comments disappear. Anchors and aliases are expanded, which can make the JSON longer when the YAML reused large blocks. Key order is preserved.
Custom tags such as !Ref or !GetAtt, used by AWS CloudFormation, are not standard YAML and may cause warnings or be converted as plain values. Convert CloudFormation templates with AWS tooling when those tags matter.
YAML 1.2 versus 1.1
Older YAML parsers followed YAML 1.1, where yes, no, on and off meant true or false and values like 0755 were octal numbers. This converter follows YAML 1.2, where those words stay strings unless written as true or false. That is safer, but it may differ from what an older tool produced.
Dates written without quotes stay as strings in the JSON, which avoids time zone surprises.
- country: NO stays "NO" (the Norway problem avoided).
- enabled: true becomes true.
- mode: 0755 stays a number in YAML 1.2 as 755.
Tips for YAML to JSON
- Use spaces, never tabs, for YAML indentation.
- Quote strings that contain colons followed by spaces.
- Check multi-document output: it is an array even if you expected one object.
- Convert back with JSON to YAML after editing, if needed.
YAML to JSON questions
Does it support files with several documents?
Yes. Each document separated by --- becomes one element of a JSON array.
Are comments kept?
No. JSON has no comment syntax, so comments are removed.
Which YAML version is used?
YAML 1.2, the current specification, so yes and no remain strings.
What happens to anchors and aliases?
They are resolved and the referenced values are copied into place.
Why did my conversion fail?
Usually an indentation error or a tab character. The error message points to the problem.
Is the file uploaded?
No. Parsing runs in your browser.