JSON to YAML
Convert JSON to YAML and back, with type inference and clean formatting.
Entrada JSON
Salida YAML
Escribe JSON a la izquierda para convertirlo.
¿Qué es JSON to YAML?
A JSON to YAML (and YAML to JSON) converter translates between two of the most popular data serialization formats. JSON is the lingua franca of web APIs and modern applications — concise, unambiguous, and supported everywhere. YAML is a human-friendly superset that's heavily used in configuration files (Kubernetes, Docker Compose, GitHub Actions, CI/CD pipelines) because it allows comments, multi-line strings, and is generally easier to read at a glance. Converting between them comes up constantly: extracting values from a JSON API response into a YAML config, porting application settings from JSON to YAML, or debugging a YAML file by converting it to JSON for easier inspection. The conversion is lossless for the core data types both formats share (objects, arrays, strings, numbers, booleans, and null), but YAML features like anchors, aliases, custom tags, and unquoted boolean-looking words (yes/no, on/off) are normalized to JSON equivalents.
Cómo usar JSON to YAML
- Pick a direction using the JSON ⇄ YAML toggle at the top (or click the swap button to reverse it, carrying today's output into the other side as new input).
- For JSON → YAML, paste any JSON value — object, array, or scalar — into the left panel. Nested structures become indented YAML mappings and sequences.
- For YAML → JSON, paste YAML content into the left panel. The parser follows JSON-compatible rules only (no custom tags, no anchors/aliases, !!str/!!int/!!bool tags are ignored).
- The converted result appears instantly on the right; copy it once you're happy with it.
Ejemplos
Simple JSON object → YAML
Entrada
{ "name": "Production", "replicas": 3, "enabled": true, "metadata": null }
Salida
name: Production replicas: 3 enabled: true metadata: null
Nested array → YAML
Entrada
{ "services": [ { "name": "web", "port": 8080 }, { "name": "api", "port": 3000 } ] }
Salida
services: - name: web port: 8080 - name: api port: 3000
YAML → JSON (with type inference)
Entrada
database: host: localhost port: 5432 ssl: true pool: null
Salida
{ "database": { "host": "localhost", "port": 5432, "ssl": true, "pool": null } }
Errores comunes
- Assuming YAML's yes/no map to JSON strings 'yes'/'no' — YAML treats yes/no as boolean values, not strings, so converting them to JSON yields true/false. If you need string values, quote them in your YAML: 'yes', 'no'.
- Expecting YAML comments to survive round-trip conversion — JSON has no comment syntax, so YAML comments (# this is a comment) are discarded when converting to JSON, and converting the JSON back to YAML won't restore them.
- Using unquoted values like 1234 and assuming they'll stay strings — in YAML, an unquoted value that looks like a number becomes a JSON number. If you need it as a string in JSON, quote it in YAML: '1234'. This is especially common with IDs and zip codes.
Por qué usar esta herramienta
- Lossless for core types — objects, arrays, strings, numbers, booleans, and null convert bidirectionally without data loss for the JSON-compatible subset of YAML.
- Human-readable output — JSON to YAML output is clean and indented, making it easy to read and hand-edit, which is useful for generating config files from API responses.
- Type-aware conversion — YAML's type inference (numbers, booleans, null) is applied when converting YAML to JSON, so you get properly typed JSON rather than everything as strings.