Data Format Converter

JSON to YAML Converter

Paste JSON or open a file to get readable YAML. The conversion runs entirely in your browser, so your data is never uploaded.

Swap to YAML to JSON

Paste text, or drop a file here

YAML

    Example

    JSON input

    [
      { "id": 1, "name": "Ada", "address": { "city": "London" }, "tags": ["math", "code"] },
      { "id": 2, "name": "Grace", "address": { "city": "New York" }, "active": true }
    ]

    YAML

    - id: 1
      name: Ada
      address:
        city: London
      tags:
        - math
        - code
    - id: 2
      name: Grace
      address:
        city: New York
      active: true

    How it handles tricky cases

    Strings that look like other types

    A string such as "123" or "true" is quoted in the YAML, so it stays a string when read back.

    Key order

    Keys stay in the order they have in the JSON, apart from keys that look like integers, which JavaScript sorts first.

    Repeated values

    Identical objects are written out in full rather than as anchors and aliases, so the output works with simple parsers.

    Long lines

    Long strings stay on one line instead of being wrapped, which keeps diffs small.

    Very long integers

    Integers too long for exact numeric handling are written as text, and a note says so.

    Do it from code

    Command line with yq:

    yq -p=json -o=yaml in.json > out.yaml

    Questions

    Is every JSON file valid YAML?

    Very nearly. YAML 1.2 was designed as a superset of JSON, but converting gives a far more readable result.

    Can I choose the indent?

    Yes, 2 or 4 spaces.

    Is my JSON uploaded?

    No. It is converted on your device.

    Related tools