How to use it
- Choose the direction: JSON → YAML or YAML → JSON.
- Paste your data or press “Try an example”. The result updates as you type.
- Pick 2 or 4 spaces of indentation for the output.
- Copy or download the result. “Use output as input” flips the direction so you can convert back.
How it works
Conversion uses the open-source yaml library (version 2), which implements the YAML 1.2 specification. YAML 1.2 is a superset of JSON for practical purposes, so any JSON document converts to YAML without loss, and YAML that uses only maps, lists, strings, numbers, booleans and null converts back to identical JSON.
When writing YAML, the tool quotes strings that a reader could take for something else. Older YAML 1.1 parsers, such as PyYAML and many CI tools, read yes, no, on and off as booleans, 0777 as an octal number and 2024-01-31 as a date, so these are written as "yes", "0777" and "2024-01-31". Long strings are not folded onto several lines. Comments cannot be carried over, because JSON has no comments.
When reading YAML, anchors (&name) and aliases (*name) are expanded, including the << merge key, and a file with several documents separated by --- becomes a JSON array. To protect your browser, alias expansion is limited, which stops “billion laughs” documents. YAML values without a JSON equivalent are converted as closely as possible: .inf and .nan become null, and timestamps stay strings. Syntax errors are reported with their line and column.
Examples
Kubernetes manifest
A Deployment written as JSON by a script converts to the YAML layout kubectl users expect, with lists under containers written as - name: web. Values like "no" stay quoted so they remain strings.
CI config with anchors
A pipeline file defines defaults: &defaults and reuses them with <<: *defaults. Converting to JSON shows exactly which keys each job ends up with after the merge.
OpenAPI specification
An OpenAPI file is maintained in YAML, but a code generator needs JSON. Paste the YAML, choose 2-space indentation and download the .json file.
Frequently asked questions
Why is "yes" written in quotes in my YAML?
Under YAML 1.1 rules, still used by PyYAML, Ansible and many other tools, an unquoted yes, no, on or off is a boolean. Quoting keeps it a string in every parser. The quotes are not part of the value.
Are YAML comments kept when converting to JSON?
No. JSON has no comment syntax, so comments are dropped. Converting the JSON back to YAML will not restore them.
What happens with several YAML documents separated by ---?
They are converted into one JSON array with one element per document, in order. A single document converts to its value directly.
What about custom tags such as CloudFormation's !Ref?
Application-specific tags are not understood. The tool shows a warning and converts the tagged value as a plain value, so !Ref MyBucket becomes the string "MyBucket" and the tag itself is lost.
Privacy
Both directions run entirely in your browser. Your JSON or YAML is not uploaded, stored or included in analytics.