JSON ↔ YAML Converter - Convert Between JSON and YAML
Developer Tools
Convert JSON to YAML or YAML to JSON in your browser. Open local .json or .yaml files and download results. Your data stays on your device.
Open or drop a local .json, .yaml, or .yml file (max 500 KB).
How to use this tool
- Add input. Paste JSON or YAML into the input panel, or open a local .json, .yaml, or .yml file.
- Auto-detect or choose. The direction is detected automatically, or you can choose manually.
- Copy or download output. Copy the converted text or download it as a .json or .yaml file.
JSON vs YAML: what's the difference?
Both formats represent structured data (objects, arrays, strings, numbers, booleans, null), but they have different syntaxes:
- JSON: Strict, machine-friendly. Uses curly braces, square brackets, and double-quoted strings. The de-facto format for APIs.
- YAML: Human-friendly. Uses indentation instead of brackets. Supports
comments (
#). Common in configuration files (Docker Compose, GitHub Actions, Kubernetes).
YAML is a superset of JSON; all valid JSON is valid YAML, but YAML has many additional features.
When to use each format
- JSON: REST APIs, data interchange, package manifests (
package.json) - YAML: CI/CD pipelines (
.github/workflows), Docker Compose, Kubernetes, Ansible, configuration files
YAML gotchas
- Indentation matters: use spaces, never tabs.
- Boolean spellings vary by YAML version: some YAML 1.1 tools treat
yes,no,on, andoffas booleans. This converter uses YAML 1.2-style boolean values, so those four spellings stay strings;trueandfalseare booleans. - The Norway problem: YAML 1.1 parsers may read country codes like
NOas booleanfalse. This converter keepsNOas a string, but quoting country codes remains a good choice when sharing YAML with older tools. - Strings that look like numbers: this converter keeps digit strings with
leading zeros, such as
007, as strings so ZIP codes and fixed-width IDs survive conversion. Other YAML tools may apply different numeric rules. - Date auto-parsing: this converter leaves bare dates such as
2024-01-15as strings. Some other YAML parsers may turn them into date values, so quote dates when moving configuration between tools with different rules. - Colons in strings: a colon followed by a space (
:) starts a new mapping key, so such strings must be quoted.
YAML anchors and aliases
YAML supports anchors (&name) and aliases
(*name) to reuse content without repetition:
defaults: &defaults
retries: 3
timeout: 30
production:
<<: *defaults
host: prod.example.com
staging:
<<: *defaults
host: staging.example.com
The <<: merge key merges the referenced mapping into the current object. This
is widely used in Docker Compose files and CI/CD pipelines to avoid repeating shared configuration.
This converter does not expand anchors, aliases, or merge keys; expand them with yq
or your editor before converting. Multi-document streams, flow collections, and |
or > block scalars are also outside its supported subset and produce a line-numbered
error.
Frequently asked questions
What is the difference between JSON and YAML?
JSON (JavaScript Object Notation) uses curly braces and quotes and is strict about syntax. YAML (YAML Ain't Markup Language) is a superset of JSON that uses indentation instead of brackets and is more human-readable.
Is my data sent anywhere?
No. Conversion happens in your browser, and selected JSON or YAML files are read locally. Neither pasted values nor file contents are uploaded.
What YAML features are supported?
This converter supports block-style mappings and sequences, quoted or plain strings, decimal numbers, true/false/null/~ values, and comments. It keeps yes, no, on, off, and leading-zero values such as 007 as strings. Anchors, aliases, merge keys, flow collections, block scalars, and multi-document streams are not supported; unsupported constructs show a line and column error.
Why does the converter quote some strings?
When creating YAML from JSON, the converter quotes strings that could be read as numbers, YAML null or boolean values, or syntax. During YAML import, yes/no/on/off and leading-zero values stay strings, while true/false/null/~ use YAML 1.2-style scalar meanings.
Related tools
- JSON FormatterUse JSON Formatter to format, validate, and minify JSON instantly in your.
- JSON ↔ XMLConvert the same structured data to XML when another system expects tagged documents.
- JSON to CSVTurn tabular JSON arrays into CSV for spreadsheets or data exports.
- YAML FormatterUse YAML Formatter to format and validate YAML online. Detect syntax errors,.
- TOML ↔ JSON ConverterUse TOML ↔ JSON Converter to convert TOML to JSON or JSON to TOML.
- Docker Compose GeneratorUse Docker Compose Generator to build docker-compose.yml files visually. Add multiple services with.