Skip to content
jsonforge.app

JSON to YAML

Convert JSON to YAML and back, with type inference and clean formatting.

JSON input

Loading editor…

YAML output

Enter JSON on the left to convert it.

What is JSON to YAML?

A JSON to YAML (and YAML to JSON) converter translates between two of the most popular data serialization formats. JSON is the lingua franca of web APIs and modern applications — concise, unambiguous, and supported everywhere. YAML is a human-friendly superset that's heavily used in configuration files (Kubernetes, Docker Compose, GitHub Actions, CI/CD pipelines) because it allows comments, multi-line strings, and is generally easier to read at a glance. Converting between them comes up constantly: extracting values from a JSON API response into a YAML config, porting application settings from JSON to YAML, or debugging a YAML file by converting it to JSON for easier inspection. The conversion is lossless for the core data types both formats share (objects, arrays, strings, numbers, booleans, and null), but YAML features like anchors, aliases, custom tags, and unquoted boolean-looking words (yes/no, on/off) are normalized to JSON equivalents.

How to use JSON to YAML

  1. Pick a direction using the JSON ⇄ YAML toggle at the top (or click the swap button to reverse it, carrying today's output into the other side as new input).
  2. For JSON → YAML, paste any JSON value — object, array, or scalar — into the left panel. Nested structures become indented YAML mappings and sequences.
  3. For YAML → JSON, paste YAML content into the left panel. The parser follows JSON-compatible rules only (no custom tags, no anchors/aliases, !!str/!!int/!!bool tags are ignored).
  4. The converted result appears instantly on the right; copy it once you're happy with it.

Examples

Simple JSON object → YAML

Input

{ "name": "Production", "replicas": 3, "enabled": true, "metadata": null }

Output

name: Production replicas: 3 enabled: true metadata: null

Nested array → YAML

Input

{ "services": [ { "name": "web", "port": 8080 }, { "name": "api", "port": 3000 } ] }

Output

services: - name: web port: 8080 - name: api port: 3000

YAML → JSON (with type inference)

Input

database: host: localhost port: 5432 ssl: true pool: null

Output

{ "database": { "host": "localhost", "port": 5432, "ssl": true, "pool": null } }

Common mistakes

  • Assuming YAML's yes/no map to JSON strings 'yes'/'no' — YAML treats yes/no as boolean values, not strings, so converting them to JSON yields true/false. If you need string values, quote them in your YAML: 'yes', 'no'.
  • Expecting YAML comments to survive round-trip conversion — JSON has no comment syntax, so YAML comments (# this is a comment) are discarded when converting to JSON, and converting the JSON back to YAML won't restore them.
  • Using unquoted values like 1234 and assuming they'll stay strings — in YAML, an unquoted value that looks like a number becomes a JSON number. If you need it as a string in JSON, quote it in YAML: '1234'. This is especially common with IDs and zip codes.

Why use this tool

  • Lossless for core types — objects, arrays, strings, numbers, booleans, and null convert bidirectionally without data loss for the JSON-compatible subset of YAML.
  • Human-readable output — JSON to YAML output is clean and indented, making it easy to read and hand-edit, which is useful for generating config files from API responses.
  • Type-aware conversion — YAML's type inference (numbers, booleans, null) is applied when converting YAML to JSON, so you get properly typed JSON rather than everything as strings.

Frequently asked questions