Conversor de YAML a JSON

¿Necesitas la conversión inversa?
JSON to YAML Converter

Entrada YAML

1

Salida JSON

Ingresa datos en YAML para convertirlos a JSON

Tus datos convertidos aparecerán aquí

Cómo convertir YAML a JSON en línea – guía paso a paso

Usa este conversor YAML→JSON para transformar archivos de configuración, manifiestos de Kubernetes o configs de CI/CD a JSON para APIs y herramientas.

  1. Paso 1 – Pega o sube YAML

    • Pega YAML en el editor izquierdo o sube un archivo .yaml o .yml.
    • Funciona con configs de Kubernetes, Docker Compose, workflows de GitHub Actions y YAML general.
    • El YAML multi-documento (separado por ---) se convierte en un array JSON.
  2. Paso 2 – Revisa la conversión

    • La salida JSON aparece a la derecha, preservando estructuras anidadas y tipos de datos.
    • Los comentarios de YAML se eliminan (JSON no admite comentarios).
    • Comprueba que arrays, objetos y valores escalares se conviertan correctamente.
  3. Paso 3 – Maneja casos especiales

    • Los anchors y aliases de YAML pueden requerir ajustes manuales en archivos complejos.
    • Los booleanos (true/false, yes/no) se normalizan a booleanos JSON.
    • Los números y cadenas se conservan con el formato JSON correcto.
  4. Paso 4 – Copia o descarga JSON

    • Usa “Copiar” para enviarlo al portapapeles.
    • O “Descargar” para guardarlo como archivo .json.
    • Usa el JSON en APIs REST, apps frontend o cualquier herramienta que requiera JSON como entrada.

Quick tips for YAML to JSON

  • Ensure indentation is consistent in your YAML; most conversion errors come from bad indent levels.
  • Multi-document YAML will be converted to a JSON array, which is ideal for lists of configs or resources.
  • After converting, run the JSON through the validator or formatter to catch any remaining structural issues.
Example: YAML to JSON
# YAML input
apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config
data:
  database_url: postgres://localhost/db
  debug: true
  ports:
    - 8080
    - 8081

// JSON output
{
  "apiVersion": "v1",
  "kind": "ConfigMap",
  "metadata": {
    "name": "app-config"
  },
  "data": {
    "database_url": "postgres://localhost/db",
    "debug": true,
    "ports": [8080, 8081]
  }
}

Related YAML & JSON tools

Convert between formats and work with configuration files using these complementary tools.

Preguntas frecuentes

What YAML features are supported in the conversion?

The converter supports standard YAML features including scalars, sequences (arrays), mappings (objects), multi-line strings, and basic YAML syntax. Complex YAML features like anchors and references may have limited support.

How are YAML comments handled during conversion?

YAML comments are typically stripped during conversion to JSON since JSON doesn't support comments. The conversion focuses on the data structure rather than preserving comments.

Can I convert complex nested YAML structures?

Yes, the converter can handle deeply nested YAML structures with multiple levels of objects and arrays. The resulting JSON will maintain the same hierarchical structure.

What happens to YAML data types during conversion?

YAML data types are converted to their JSON equivalents: strings remain strings, numbers become JSON numbers, booleans stay as booleans, and null values are preserved. YAML's additional data types are converted to their closest JSON representation.

Conversor de YAML a JSON | JSONSwiss