DataShift

Convert JSON to YAML Online

Convert JSON configs, environment files, and API schemas to clean, human-readable YAML. Handles multiline strings, YAML reserved values, and OpenAPI specs.

JSON → YAML

Free JSON to YAML converter. Convert any JSON to YAML — Docker Compose configs, Kubernetes manifests, OpenAPI specs. Handles multiline strings, reserved values, and nested structures. Works in your browser.

100% local — no uploads
Input · JSON

Output will appear here

How to use the JSON → YAML

  1. Paste or upload your JSON data

    Paste text directly into the input box, drag and drop a file onto it, or click "Upload file" to browse. Conversion starts instantly on paste — no button click required.

  2. Configure options (optional)

    Open the Options panel to customise delimiter, headers, nested-object flattening, and more. Use the Field Selector to pick exactly which columns appear in the output.

  3. Copy or download your YAML

    Click Copy to grab the result, or Download to save the file. Everything runs locally in your browser — no data ever leaves your device.

Example

Input (JSON)

[
  { "id": 1, "name": "Alice" }
]

Output (YAML)

- id: 1
  name: Alice

Frequently Asked Questions

Is my data safe?
Yes. Every conversion runs entirely inside your browser. No data is ever transmitted to a server. The tool works offline once loaded.
What is the maximum file size?
There is no hard limit. Files under 1 MB convert instantly. Files 1–10 MB show a progress indicator. Files over 10 MB prompt a warning and run in a background thread to keep the browser responsive.
Why does my JSON fail to parse?
Common causes are trailing commas, single-quoted strings, unquoted keys, or missing closing brackets. The converter auto-repairs many of these and tells you exactly what it changed.
Can I convert multiple files at once?
The tool handles one file at a time. For bulk conversion, consider the csvjson CLI or API.

How it works

Step 1

Objects and arrays map directly

JSON objects become YAML mappings. JSON arrays become YAML sequences. The nesting structure is preserved exactly — no flattening, no reordering.

Step 2

Strings are quoted only when necessary

YAML has reserved values: 'true', 'false', 'null', 'yes', 'no', bare numbers, and strings containing colons. Any value that would be misread by a YAML parser is automatically quoted. Everything else stays unquoted for readability.

Step 3

Multiline strings use YAML block scalars

Long strings that contain newlines are serialized using YAML's literal block scalar style (|) instead of a single quoted string. This keeps config files readable and diff-friendly.

Example

Docker Compose v3 service config converted for a GitOps repo

Input
{
  "version": "3.9",
  "services": {
    "api": {
      "image": "node:18",
      "environment": {
        "NODE_ENV": "production",
        "PORT": 3000
      },
      "ports": ["3000:3000"],
      "depends_on": ["postgres"]
    },
    "postgres": {
      "image": "postgres:15",
      "environment": {
        "POSTGRES_PASSWORD": "secret"
      }
    }
  }
}
Output
version: '3.9'
services:
  api:
    image: 'node:18'
    environment:
      NODE_ENV: production
      PORT: 3000
    ports:
      - '3000:3000'
    depends_on:
      - postgres
  postgres:
    image: 'postgres:15'
    environment:
      POSTGRES_PASSWORD: secret

'3.9' is quoted because bare 3.9 would be parsed as a float. PORT: 3000 is not quoted because it's already a number.

Edge cases, handled

YAML reserved values

Strings like 'true', 'false', 'null', 'yes', 'no', 'on', 'off' are YAML booleans/nulls if unquoted. Any JSON string matching these values is automatically quoted in the output.

Strings with colons

A string like 'host:port' contains a colon, which YAML interprets as a key-value separator. These strings are quoted automatically to prevent parse errors.

OpenAPI and JSON Schema

JSON Schema documents — including OpenAPI/Swagger specs — convert cleanly. $ref pointers, allOf/oneOf/anyOf arrays, and all schema keywords are preserved exactly.

Frequently asked questions

Why are some strings quoted in the YAML output and others aren't?

YAML has reserved values — 'true', 'false', 'null', 'yes', 'no', 'on', 'off', and bare numbers. Any JSON string that would be misinterpreted as one of these is automatically quoted. Strings containing colons, leading/trailing spaces, or special characters are also quoted. Everything else is left unquoted.

Can I convert JSON Schema or OpenAPI specs to YAML?

Yes. JSON Schema and OpenAPI/Swagger documents are valid JSON and convert cleanly to YAML. The $ref pointers, allOf/oneOf arrays, and all schema keywords are preserved. Many teams use JSON internally and YAML for their public API docs — this converter handles that workflow.

Does the YAML output use anchors and aliases?

No. The output uses noRefs mode — every value is written out fully, with no YAML anchors (&) or aliases (*). This produces more verbose but maximally portable YAML that any parser handles without issues.

I need to convert a GitHub Actions workflow from JSON to YAML — will this work?

Yes. GitHub Actions workflows are standard YAML. If you have the equivalent JSON structure, this converts it directly. Note that 'on' (the workflow trigger key) is a YAML reserved word and will be quoted as 'on' in the output — GitHub Actions handles quoted 'on' correctly.

What indentation does the YAML output use?

Two spaces by default, which is the most common convention for Kubernetes, Docker Compose, and GitHub Actions. The indentation is consistent throughout the entire document.