JSON ↔ YAML
Convert between JSON and YAML in your browser. Handles Unicode, deep nesting, and clear error reporting with line/column information.
About this tool
JSON and YAML describe the same kinds of data: maps, lists, strings, numbers, booleans, null. YAML adds comments, anchors, and a more readable block style; JSON is stricter and produces smaller, less forgiving output. The two formats are commonly converted during config translation, between API payloads and human-edited files, and when dealing with mixed-tool pipelines (Kubernetes manifests vs. REST APIs).
This tool uses js-yaml, the reference JavaScript YAML 1.2 implementation, plus the browser’s built-in JSON engine. Both directions round-trip losslessly for data that can be expressed in pure JSON. YAML-only features (comments, anchors, custom tags) are stripped during YAML → JSON conversion, which is expected behavior rather than a bug.
Unicode is preserved through both directions. Indent is configurable (2 spaces, 4 spaces, or tab) and line width is not truncated so that long strings remain readable. Errors include the position in the input where parsing failed.
Frequently asked questions
Are JSON and YAML interchangeable?
Mostly. YAML is a superset of JSON in structure — every JSON document is valid YAML 1.2. The common round-trip loses only comments, anchors, custom tags, and some YAML-specific scalar nuances (e.g., unquoted “yes” → true in YAML 1.1).
Why did my YAML comment disappear?
JSON has no comment syntax. When converting YAML → JSON, comments are discarded. Converting back produces YAML without the original comment.
Does this preserve key order?
Yes. The parser uses insertion order, and the emitter preserves it. If you need sorted keys, sort them before conversion.
What YAML features are not supported?
Custom tags, anchors and aliases are flattened. Binary data (!!binary) is preserved. Non-string keys in mappings are coerced to strings when going to JSON.
Is my input sent to your servers?
No. Parsing and emitting happen entirely in your browser using js-yaml and the native JSON engine.