Convertitore YAML in JSON

Ti serve la conversione inversa?
JSON to YAML Converter

Input YAML

1

Output JSON

Inserisci dati in YAML per convertirli in JSON

I dati convertiti appariranno qui

Come convertire YAML in JSON online – guida passo dopo passo

Usa questo convertitore YAML→JSON per trasformare file di configurazione, manifest Kubernetes o config CI/CD in JSON per API e tooling.

  1. Passo 1 – Incolla o carica YAML

    • Incolla YAML nell’editor a sinistra o carica un file .yaml o .yml.
    • Funziona con config Kubernetes, Docker Compose, workflow GitHub Actions e YAML generico.
    • Lo YAML multi-documento (separato da ---) viene convertito in un array JSON.
  2. Passo 2 – Controlla la conversione

    • L’output JSON appare a destra preservando strutture annidate e tipi di dati.
    • I commenti YAML vengono rimossi (JSON non supporta commenti).
    • Verifica che array, oggetti e valori scalari siano convertiti correttamente.
  3. Passo 3 – Gestisci i casi limite

    • Ancore e alias YAML possono richiedere aggiustamenti manuali in file complessi.
    • I booleani (true/false, yes/no) vengono normalizzati in booleani JSON.
    • Numeri e stringhe vengono preservati con formattazione JSON corretta.
  4. Passo 4 – Copia o scarica il JSON

    • Usa “Copia” per inviare il JSON negli appunti.
    • Oppure “Scarica” per salvare come file .json.
    • Usa il JSON in API REST, app frontend o qualsiasi tool che richieda JSON come input.

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.

Domande frequenti

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.

Convertitore YAML in JSON | JSONSwiss