YAML ↔ JSON Converter (2026)
Bidirectional YAML/JSON converter. Paste YAML to get JSON, or JSON to get YAML — swap direction with one click. Built on js-yaml (YAML 1.2). Runs entirely in your browser.
{
"openapi": "3.1.0",
"info": {
"title": "Specway Tools API",
"version": "1.0.0"
},
"paths": {
"/tools": {
"get": {
"summary": "List tools",
"responses": {
"200": {
"description": "OK"
}
}
}
}
}
}YAML vs JSON: when to use each
YAML is human-friendly: indentation-based, comment-supporting, terse. Great for config files and hand-edited specs (CI configs, OpenAPI, Kubernetes manifests).
JSON is machine-friendly: braces and brackets, strict, universal parser support. Required by most APIs, almost all programming languages, and every browser.
You usually author in YAML and ship in JSON. This tool is the bridge.
Lossless round-trip caveats
- YAML anchors and aliases (
&ref / *ref) get expanded when converting to JSON. Round-tripping back to YAML won't recreate them — the data is identical, the structure is just inlined. - YAML comments don't exist in JSON. Convert YAML→JSON→YAML and you'll lose all comments.
- YAML multi-document streams (separated by
---) have no JSON equivalent — convert each document separately. - Number precision: very large integers (> 2^53) get rounded. JSON doesn't distinguish int vs float cleanly. If you need bigint precision, send strings.
OpenAPI authoring workflow
Most OpenAPI specs are authored in YAML for the comment support and readability advantage. CI then runs validation on both YAML and JSON representations, and the deployed docs ship JSON because most tooling (and Specway) ingests both.
If your repo has only YAML, this tool is the quick fix when a tool wants JSON. For automated pipelines, use js-yaml in Node or PyYAML in Python directly.