YAML ↔ JSON Converter - Config file translator
Convert configuration files between YAML and JSON format locally and instantly.
History
How it works
This tool lets you convert configuration files and data structures between YAML and JSON. Everything happens directly in your browser, meaning sensitive configuration details are never sent over the internet.
About this tool
YAML and JSON describe the same kind of data but in very different ways. YAML uses indentation, short key/value pairs and little punctuation, which makes it the favourite for config files in Docker Compose, Kubernetes, GitHub Actions and Ansible. JSON uses braces, quotes and commas, and is the standard for machine-to-machine communication. This tool converts between the two directly in the browser: YAML to JSON when you need to send config to an API, JSON to YAML when you want a more readable version. YAML comments are documented in the output because JSON does not support them.
How to use it
- Paste YAML or JSON content in the text area.
- The tool detects the format automatically and shows the opposite in the other panel.
- Adjust indent size (2 or 4 spaces) and "flow" vs "block" style for YAML if needed.
- Copy or download the result as .yaml or .json.
Examples
app:
name: verktoy
port: 3000
hosts:
- dev
- prod{
"app": {
"name": "verktoy",
"port": 3000,
"hosts": ["dev", "prod"]
}
}defaults: &d
timeout: 30
retries: 3
prod:
<<: *d
timeout: 60{
"defaults": {"timeout":30,"retries":3},
"prod": {"timeout":60,"retries":3}
}Common use cases
- Convert Kubernetes manifests between YAML and JSON for API calls.
- Read or edit GitHub Actions and GitLab CI files.
- Migrate legacy JSON configs to more readable YAML.
- Prepare Ansible, Helm or docker-compose setups.
- Debug YAML syntax that fails to parse, the error message shows line and column.
Frequently asked questions
- Is YAML a superset of JSON?
- As of YAML 1.2 (2009): yes, any valid JSON is also valid YAML. YAML adds indentation syntax, comments, anchors and merge keys that JSON lacks.
- What is the "Norway problem" in YAML?
- YAML 1.1 interprets unquoted values like NO, YES, ON, OFF as booleans. Norway’s country code NO therefore becomes false. Use YAML 1.2 or quote the value: "NO".
- Are numbers preserved exactly?
- Partially. The standard JavaScript JSON parser handles numbers as IEEE 754 doubles, so integers above 2^53 lose precision. Use BigInt or send the number as a string if you need full precision.
- What happens to comments?
- YAML→JSON: comments are lost because JSON does not support them. JSON→YAML: the tool does not add comments. Add them manually if you need them.
Technical background
YAML ("YAML Ain’t Markup Language") originated in 2001 and focuses on readability. Data types include scalar (strings, numbers, booleans, null), sequence (lists) and mapping (dictionaries). Indentation (spaces only, no tabs) defines structure. YAML 1.2 removed many quirks from 1.1, including the cryptic "Norway" boolean. Anchors ("&anchor") and aliases ("*anchor") let you reuse fragments, and merge keys ("<<") copy fields from other nodes. JSON, defined in RFC 8259, only allows six types: object, array, string, number, boolean and null. Strings must use double quotes, no comments exist, and numbers are simple numeric notation. Converting YAML to JSON requires expanding anchor and merge references, and mapping tags like !!binary or !!timestamp to the closest JSON primitive (base64 string, ISO 8601 string). The reverse is trivial since all JSON types exist in YAML.