YAML / JSON Converter
Convert between YAML and JSON formats. Paste in either format and get the other instantly.
How It Works
The YAML/JSON Converter translates between YAML 1.2 and JSON in either direction, preserving the full data structure including nested objects, arrays, strings, numbers, booleans, and null. Paste YAML or JSON in the source panel, click the directional arrow, and the converted output appears in the destination panel. JSON-to-YAML produces idiomatic two-space-indented YAML with block-style mappings and sequences, which is what most config-file conventions expect. YAML-to-JSON produces minified or pretty-printed JSON, your choice. Because JSON is a strict subset of YAML 1.2, any valid JSON input round-trips through this tool without loss; YAML’s richer feature set (anchors, aliases, multi-document streams, tagged values) may be flattened or rejected with a clear error message when converting to JSON. Common gotchas — the YAML ‘Norway problem’ where unquoted NO was historically interpreted as boolean false, octal literal pitfalls, indentation errors — are surfaced inline with the parser’s exact error message. The conversion runs entirely in your browser so configuration files containing internal hostnames or secrets stay on your device.
Use Cases
- Converting Kubernetes or Docker Compose YAML configs to JSON for API payloads
- Translating JSON API responses into YAML for human-readable documentation
- Migrating config files between toolchains that expect different formats
- Quickly checking that a YAML file is syntactically valid
Frequently Asked Questions
- Why did my YAML produce a string when I expected a number?
- YAML 1.2 quotes strings unless they look like numbers. If your input was '42' (quoted) it becomes a string; 42 (unquoted) becomes a number. Round-tripping through JSON forces explicit types.
- What is the Norway problem?
- YAML 1.1 interpreted unquoted NO and YES as booleans, so a list of country codes broke surprisingly. YAML 1.2 fixed this; this tool follows 1.2 semantics.
- Are anchors and aliases preserved?
- They are resolved (expanded) when converting YAML to JSON, since JSON has no anchor concept. The semantics are preserved; the textual structure is not.
- What about multi-document YAML?
- Multi-document YAML (separated by ---) is partially supported — only the first document is converted. For multi-document streams, split externally first.
- Is my input sent anywhere?
- No. Parsing and conversion happen entirely in your browser.