JSON to YAML

Convert JSON to YAML format

JSON Input

YAML Output

How to use the JSON to YAML Converter

  1. Paste your JSON into the input editor on the left. The tool accepts any valid JSON: objects, arrays, nested structures, and primitive values.
  2. View the YAML output that appears automatically in the right panel. The conversion happens in real-time as you type or paste.
  3. Configure indentation using the options to set your preferred indent size (typically 2 spaces for YAML). Adjust to match your project's style conventions.
  4. Copy the YAML output to your clipboard or download it as a .yaml file for use in your configuration files, CI/CD pipelines, or infrastructure definitions.

What is YAML?

YAML (originally "Yet Another Markup Language," later rebranded to "YAML Ain't Markup Language") is a human-readable data serialization format. It was designed to be easier for humans to read and write than JSON or XML, using indentation and minimal syntax to represent data structures.

Key YAML features that distinguish it from JSON:

  • No braces or brackets: Structure is conveyed through indentation (like Python).
  • Comments: YAML supports comments with #, which JSON does not.
  • Multi-line strings: YAML offers | (literal block) and > (folded block) for multi-line text.
  • Anchors and aliases: YAML can reference and reuse data within a document using &anchor and *alias.
  • Multiple data types: YAML auto-detects booleans (true/false), numbers, null, and dates without requiring quotes.

A JSON object like:

{"name": "app", "version": "1.0", "dependencies": ["express", "lodash"]}

Becomes in YAML:

name: app
version: "1.0"
dependencies:
  - express
  - lodash

YAML has become the dominant configuration format in the DevOps ecosystem. Kubernetes manifests, Docker Compose files, GitHub Actions workflows, Ansible playbooks, Helm charts, and CloudFormation templates all use YAML. Its human readability makes it ideal for configuration files that are frequently edited by hand.

However, YAML has some well-known pitfalls. The "Norway problem" is a famous example: the string NO (the country code for Norway) is interpreted as a boolean false in YAML 1.1. Similarly, version numbers like 1.0 become floating-point numbers unless quoted. These gotchas make JSON-to-YAML conversion tools valuable because they handle quoting and type preservation correctly.

Common use cases

  • Kubernetes configuration: Convert JSON API responses or programmatically generated configs into YAML manifests for kubectl apply.
  • CI/CD pipeline creation: GitHub Actions, GitLab CI, and CircleCI all use YAML. Converting JSON data structures to YAML helps when building pipeline configurations.
  • Docker Compose files: Convert docker inspect JSON output or programmatic container definitions into docker-compose.yml format.
  • Configuration migration: When migrating from JSON-based configuration to YAML-based tools, bulk conversion ensures accuracy and proper formatting.
  • Documentation: YAML is more readable in documentation and tutorials. Convert complex JSON examples to YAML for clearer presentation.

FAQ

Q: Can all JSON be represented as YAML? A: Yes. YAML is a superset of JSON (technically, every valid JSON document is also valid YAML). The conversion is lossless -- all JSON data types map cleanly to YAML equivalents.

Q: Are there cases where YAML might misinterpret my data? A: Yes. YAML auto-detects types, so strings like true, null, 1.0, or NO may be interpreted as booleans, null, floats, or booleans respectively. This converter adds quotes where necessary to preserve the original JSON types.

Q: Which indentation should I use for YAML? A: Two spaces is the most common convention and the default in most tools. Kubernetes, Docker Compose, and GitHub Actions all use 2-space indentation. Some teams prefer 4 spaces for readability. Tabs are not allowed in YAML.

Is my data safe?

Yes. This tool runs entirely in your browser. Your data is never sent to our servers.

How to use the JSON to YAML Converter

  1. Paste your JSON into the input editor on the left. The tool accepts any valid JSON: objects, arrays, nested structures, and primitive values.
  2. View the YAML output that appears automatically in the right panel. The conversion happens in real-time as you type or paste.
  3. Configure indentation using the options to set your preferred indent size (typically 2 spaces for YAML). Adjust to match your project's style conventions.
  4. Copy the YAML output to your clipboard or download it as a .yaml file for use in your configuration files, CI/CD pipelines, or infrastructure definitions.

What is YAML?

YAML (originally "Yet Another Markup Language," later rebranded to "YAML Ain't Markup Language") is a human-readable data serialization format. It was designed to be easier for humans to read and write than JSON or XML, using indentation and minimal syntax to represent data structures.

Key YAML features that distinguish it from JSON:

  • No braces or brackets: Structure is conveyed through indentation (like Python).
  • Comments: YAML supports comments with #, which JSON does not.
  • Multi-line strings: YAML offers | (literal block) and > (folded block) for multi-line text.
  • Anchors and aliases: YAML can reference and reuse data within a document using &anchor and *alias.
  • Multiple data types: YAML auto-detects booleans (true/false), numbers, null, and dates without requiring quotes.

A JSON object like:

{"name": "app", "version": "1.0", "dependencies": ["express", "lodash"]}

Becomes in YAML:

name: app
version: "1.0"
dependencies:
  - express
  - lodash

YAML has become the dominant configuration format in the DevOps ecosystem. Kubernetes manifests, Docker Compose files, GitHub Actions workflows, Ansible playbooks, Helm charts, and CloudFormation templates all use YAML. Its human readability makes it ideal for configuration files that are frequently edited by hand.

However, YAML has some well-known pitfalls. The "Norway problem" is a famous example: the string NO (the country code for Norway) is interpreted as a boolean false in YAML 1.1. Similarly, version numbers like 1.0 become floating-point numbers unless quoted. These gotchas make JSON-to-YAML conversion tools valuable because they handle quoting and type preservation correctly.

Common use cases

  • Kubernetes configuration: Convert JSON API responses or programmatically generated configs into YAML manifests for kubectl apply.
  • CI/CD pipeline creation: GitHub Actions, GitLab CI, and CircleCI all use YAML. Converting JSON data structures to YAML helps when building pipeline configurations.
  • Docker Compose files: Convert docker inspect JSON output or programmatic container definitions into docker-compose.yml format.
  • Configuration migration: When migrating from JSON-based configuration to YAML-based tools, bulk conversion ensures accuracy and proper formatting.
  • Documentation: YAML is more readable in documentation and tutorials. Convert complex JSON examples to YAML for clearer presentation.

FAQ

Q: Can all JSON be represented as YAML? A: Yes. YAML is a superset of JSON (technically, every valid JSON document is also valid YAML). The conversion is lossless -- all JSON data types map cleanly to YAML equivalents.

Q: Are there cases where YAML might misinterpret my data? A: Yes. YAML auto-detects types, so strings like true, null, 1.0, or NO may be interpreted as booleans, null, floats, or booleans respectively. This converter adds quotes where necessary to preserve the original JSON types.

Q: Which indentation should I use for YAML? A: Two spaces is the most common convention and the default in most tools. Kubernetes, Docker Compose, and GitHub Actions all use 2-space indentation. Some teams prefer 4 spaces for readability. Tabs are not allowed in YAML.

Is my data safe?

Yes. This tool runs entirely in your browser. Your data is never sent to our servers.