Conversor de YAML para JSON

Precisa da conversão inversa?
JSON to YAML Converter

Entrada YAML

1

Saída JSON

Insira dados em YAML para convertê-los em JSON

Os dados convertidos aparecerão aqui

Como converter YAML para JSON online – guia passo a passo

Use este conversor YAML→JSON para transformar arquivos de configuração, manifests Kubernetes ou configs de CI/CD em JSON para APIs e ferramentas.

  1. Etapa 1 – Cole ou envie YAML

    • Cole YAML no editor à esquerda ou envie um arquivo .yaml ou .yml.
    • Funciona com configs Kubernetes, Docker Compose, workflows do GitHub Actions e YAML geral.
    • YAML multi-documento (separado por ---) é convertido em um array JSON.
  2. Etapa 2 – Revise a conversão

    • A saída JSON aparece à direita preservando estruturas aninhadas e tipos de dados.
    • Comentários do YAML são removidos (JSON não suporta comentários).
    • Verifique se arrays, objetos e valores escalares foram convertidos corretamente.
  3. Etapa 3 – Trate casos especiais

    • Âncoras e aliases YAML podem exigir ajustes manuais em arquivos complexos.
    • Valores booleanos (true/false, yes/no) são normalizados para booleanos JSON.
    • Números e strings são preservados com formatação JSON adequada.
  4. Etapa 4 – Copie ou baixe o JSON

    • Use “Copiar” para enviar o JSON para a área de transferência.
    • Ou “Baixar” para salvar como arquivo .json.
    • Use o JSON em APIs REST, aplicações frontend ou qualquer ferramenta que exija 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.

Perguntas Frequentes

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 para JSON | JSONSwiss