DevToolsForYou
Private by defaultRuns in your browser

JSON ↔ YAML converter

Switch between JSON and YAML formats in one click. Ideal for DevOps configs, API schemas, and any workflow where both formats are used.

Quick samplesUseful for testing
JSON ↔ YAML

About this tool

YAML is a superset of JSON, which means every valid JSON document is already valid YAML, and conversion in that direction is mostly a matter of presentation — replacing braces and quotes with indentation. The reverse is harder, because YAML has features JSON does not: comments, anchors and aliases for reuse, multi-line block scalars, multiple documents in one file separated by ---, and several ways to write the same value. Comments are the practical casualty; JSON has no syntax for them, so they are lost on conversion, which matters because comments are often the reason a config file is in YAML in the first place. YAML dominates configuration — Kubernetes manifests, Docker Compose, GitHub Actions workflows, Ansible playbooks, OpenAPI specs — while JSON dominates APIs and data interchange, so moving between them is routine work. YAML's convenience comes with sharp edges around implicit typing, which is where most conversion surprises originate. This converter detects the input format automatically and produces the other, entirely in your browser, so configuration files with credentials in them never leave your machine.

No signup requiredRuns in your browserInstant results
How to use
  1. 1

    Paste your JSON or YAML into the input field — the tool detects the format automatically.

  2. 2

    The converted output appears instantly in the other format.

  3. 3

    Use JSON→YAML for config files and YAML→JSON for APIs or data pipelines.

  4. 4

    Click Copy to copy the result.

Why use this tool?
  • →

    Convert JSON API schemas into YAML for OpenAPI / Swagger definitions.

  • →

    Transform Kubernetes or Docker Compose YAML into JSON for programmatic processing.

  • →

    Switch GitHub Actions workflow files between formats for easier editing.

ExamplesInput → output

JSON to YAML

Input{"name":"Alice","age":30,"tags":["admin","user"]}
Outputname: Alice age: 30 tags: - admin - user

YAML to JSON

Inputname: Alice age: 30
Output{ "name": "Alice", "age": 30 }
Common errorsAnd how to fix them

Comments disappear when converting YAML to JSON

Cause: JSON has no comment syntax. There is nowhere for them to go, so any comment in the source is dropped.

Fix: Keep the YAML file as the source of truth and treat the JSON as generated output. If comments must survive, move the information into a description field that is part of the data.

A country code or version string turns into an unexpected value

Cause: YAML's implicit typing. Unquoted no becomes false, so the country code NO breaks; yes and on become true; 1.0 becomes a number, so a version string loses its trailing zero; and a value like 08 can be read as octal or rejected.

Fix: Quote any string that could be read as another type — country codes, version numbers, times, and anything starting with a zero. YAML 1.2 narrowed these rules, but many parsers still follow 1.1 behaviour.

Indentation errors on conversion to YAML

Cause: YAML forbids tabs for indentation entirely, and nesting depends on exact space counts. An editor set to insert tabs produces a file that fails to parse.

Fix: Configure your editor to insert spaces in YAML files, conventionally two per level. Run the output through a YAML linter before committing it, since indentation bugs frequently parse as valid but structurally different documents.

Frequently asked questionsCommon questions answered

These answers explain common json ↔ yaml tasks, expected input formats, and edge cases so both visitors and search engines can understand what this tool does.

Does this support multi-document YAML?

The converter handles single YAML documents. For multi-document YAML (separated by ---), only the first document is converted.

Are YAML anchors and aliases supported?

Basic YAML is fully supported. Complex anchors and aliases may be flattened during conversion.

Is the conversion lossy?

JSON→YAML is lossless. YAML→JSON drops comments (YAML supports comments, JSON does not) but preserves all data values.

What is the difference between JSON and YAML?

JSON uses braces and brackets with strict quoting rules and no comments. YAML uses indentation-based structure, supports comments, and is generally more human-readable for configuration files. Both represent the same data model of objects, arrays, strings, numbers, booleans, and null.

Can I convert a Docker Compose or Kubernetes config to JSON?

Yes. Paste your YAML config into the input and select YAML→JSON. The output is valid JSON that represents the same structure. This is useful when an API or tool requires JSON but your config is written in YAML.