Categories

JSON to YAML

Convert JSON data to YAML format

JSON to YAML Converter Online

This free converter transforms JSON into clean, correctly indented YAML. It is the fastest way to convert an API response or JSON config into the YAML dialect required by Kubernetes manifests, Docker Compose files, GitHub Actions workflows, OpenAPI specs, and Ansible playbooks.

The converter validates your JSON first, so syntax errors surface immediately, and it emits standards-compliant YAML with sensible quoting. Everything runs locally in your browser.

How to use JSON to YAML

  1. Paste valid JSON into the input box — the YAML equivalent appears automatically. Long string values are kept on one line (no folding), and you can choose 2- or 4-space indentation.
  2. If the JSON has a syntax error, the parser message is shown instead — fix it and the output updates.
  3. Use the swap button to reverse direction and convert YAML back to JSON.
  4. Copy or download the result and paste it into your manifest or pipeline file.

JSON vs YAML

JSON and YAML describe the same data structures — mappings, sequences, and scalars — with different syntax. JSON uses braces, brackets, and quotes; YAML uses indentation and dashes, supports comments, and needs far less punctuation, which is why configuration ecosystems prefer it. Every JSON document is representable as YAML (YAML is a superset of JSON's data model), so this conversion is lossless.

{
  "service": {
    "name": "api",
    "replicas": 3,
    "ports": [80, 443]
  }
}

→

service:
  name: api
  replicas: 3
  ports:
    - 80
    - 443
The same structure in JSON and YAML.

Related terminology

YAML
"YAML Ain't Markup Language" — a human-friendly data serialization format that uses indentation for structure and is standard for DevOps configuration.
Mapping / sequence
YAML's names for objects (key: value pairs) and arrays (lines starting with a dash).
Scalar
A single value — string, number, boolean, or null. YAML can usually write strings unquoted.
Indentation
YAML expresses nesting through leading spaces (never tabs); this converter emits consistent 2-space indentation.

Frequently asked questions

How do I convert JSON to YAML for Kubernetes?
Paste the JSON manifest into the input box and copy the YAML output into your .yaml file. The structure and values are preserved exactly, in the indentation style Kubernetes expects.
Is the conversion lossless?
Yes. YAML's data model is a superset of JSON's, so objects, arrays, strings, numbers, booleans, and nulls all convert without loss.
Why does my input show an error?
The input must be valid JSON — common issues are trailing commas, single quotes, and unquoted keys. Fix the reported syntax error and the YAML appears automatically. You can pre-clean input with the JSON Formatter utility.
Can I convert YAML back to JSON here?
Yes. Use the swap button to switch the tool to YAML → JSON, paste your YAML, and get valid, indented JSON back — the conversion is fully bidirectional.

Related tools