YAML to JSON Converter
Paste YAML and get the JSON your tools will actually see, with anchors expanded, every digit kept, and a warning wherever YAML 1.1 would read a value differently.
Free · No signupConverted in your browser
Valid YAML · 2 documents · 31 keys · depth 8
[
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"name": "web",
"labels": {
"app": "web"
}
},
"spec": {
"replicas": 3,
"selector": {
"matchLabels": {
"app": "web"
}
},
"template": {
"metadata": {
"labels": {
"app": "web"
}
},
"spec": {
"containers": [
{
"name": "web",
"image": "nginx:1.27",
"ports": [
{
"containerPort": 80
}
]
}
]
}
}
}
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "web"
},
"spec": {
"selector": {
"app": "web"
},
"ports": [
{
"port": 80,
"targetPort": 80
}
]
}
}
]
Aliases (*name) on lines 11, 14 were replaced by the values they point to.
2 documents became one JSON array, in order.
Comments were dropped: JSON has no comments.
Converted in this tab as you type. Nothing you paste or upload leaves this page.
Configs live on servers
Ship the config, manage the servers.
CtrlOps opens the servers your YAML deploys to: edit the file in place with the file manager, run the command, and watch the logs, all over your own SSH keys.
Keep it handy
YAML and JSON,
at a glance.
The same data in two notations. Everything YAML adds on top of JSON is resolved on the way across.
| Feature | YAML | JSON |
|---|---|---|
| Comments | Yes ( # ... ) | No |
| Multiple documents | Yes ( --- separators ) | No (one root value) |
| Anchors & references | Yes ( & and * ) | No |
| Trailing commas | N/A | Not allowed |
| Human readability | High (indentation) | Medium (braces) |
| Machine parsing | Widely supported | Native everywhere |
How the converter works
Same data.
Nothing guessed.
What this converter does
YAML and JSON describe the same things, maps, lists and values, so any YAML document has a JSON equivalent. The converter parses your YAML with a full YAML parser, keeps keys in the order you wrote them, and writes JSON with the indentation you choose: 2 or 4 spaces, tabs, or minified. Numbers are copied digit for digit, so an ID like 123456789012345678901 is not rounded, and keys such as __proto__ come through as ordinary keys.
YAML 1.2 or YAML 1.1?
The two versions read some unquoted values differently. In YAML 1.2, which most new tools follow, NO and on are text and 0644 is 644. In YAML 1.1, which PyYAML and so Ansible still use, they are false, true and the octal 420, and 22:22 is the base-60 number 1342. Pick the version your tool reads. Either way, every value the other version reads differently is listed with its line, so you can quote it before it bites.
Multi-document files, anchors and merges
A file with several documents separated by ---, such as a Kubernetes manifest, becomes one JSON array in order, or JSON Lines with one document per line for jq. Anchors and aliases are replaced by the values they point to, and << merge keys are applied the way Docker Compose and Ansible apply them: keys written in the map itself win. An alias bomb that would expand to millions of values is stopped instead of freezing the tab.
Tags, comments and what JSON cannot hold
CloudFormation short tags become their JSON form, so !Ref Bucket is {"Ref": "Bucket"} and !GetAtt Bucket.Arn is {"Fn::GetAtt": ["Bucket", "Arn"]}. Other custom tags, such as Home Assistant's !secret, are dropped with a warning that names them. Comments are dropped, and .inf and .nan become null with a warning, because JSON has no way to write them.
Is it safe to paste config here?
Yes. The conversion runs entirely in your browser with no network calls, so it keeps working offline, and nothing you paste, upload or generate leaves the page. It is fine for real manifests, environment files and CI configs.
Going the other way? Convert JSON to YAMLYAML & JSON FAQ
YAML to JSON,
explained.
Paste your YAML into the left pane. The formatted JSON appears live in the right pane as you type - no button to press. Choose your indentation, optionally sort keys, then copy or download the JSON. Everything runs in your browser.
Yes. JSON is a strict subset of YAML, so any valid JSON is also valid YAML and passes through this converter unchanged. The reverse is not true: YAML has comments, anchors, and multiple documents that plain JSON cannot express.
YAML files can contain several documents separated by --- (common in Kubernetes manifests). Since JSON has no document separator, the tool outputs a JSON array with one element per document, in order. A single document converts to a single object or value.
JSON has no comments, so YAML comments are dropped. Anchors and aliases (&name and *name) are expanded to their real values, producing self-contained JSON. CloudFormation short tags such as !Ref and !GetAtt become their JSON form; any other custom tag is dropped with a warning that names it, and its value is kept as written.
The most common causes are inconsistent indentation, using tabs instead of spaces, a missing space after a colon, or a duplicate key. The tool shows the exact line and column of the error and highlights the offending line so you can fix it quickly.
Yes. The converter runs entirely client-side with no uploads or network calls, which you can verify in the browser network tab, and it works offline. Your YAML never leaves your machine, so it is safe for manifests, .env files, and secrets.
Yes. Pick 2-space, 4-space, or tab indentation, or minify to a single line. You can also sort object keys alphabetically, which makes two configs easy to diff. Copy the result to your clipboard or download it as a .json file named after your YAML file, or output.json for pasted text.
Keep working
Related tools for your next task.