JSON to YAML Converter

Paste JSON and get readable YAML that means exactly the same thing, with key order kept and values quoted wherever a YAML parser might misread them.

Input
Output

    Nothing leaves your browser. Shortcut: Ctrl/⌘ + Enter runs the main action.

    How JSON maps to YAML

    JSON and YAML describe the same data model: mappings (JSON objects), sequences (JSON arrays) and scalars (strings, numbers, booleans and null). YAML 1.2 was designed so that every JSON document is also a YAML document, so conversion never loses information. The converter writes YAML in block style: each key on its own line, nesting shown by indentation, and list items marked with - .

    JSONYAML
    {"name": "api", "port": 8080}name: api
    port: 8080
    {"tags": ["a", "b"]}tags:
      - a
      - b
    {"empty": {}, "none": []}empty: {}
    none: []
    {"v": null, "ok": true}v: null
    ok: true
    {"code": "0755", "n": "123"}code: "0755"
    n: "123"

    How to convert JSON to YAML

    1. Paste the JSON or open a .json file. It is validated first; errors are listed with line numbers and Fix JSON can repair common mistakes.
    2. Choose 2 or 4 spaces and whether keys should be sorted.
    3. Click To YAML. Copy the result or download it as data.yaml.

    Example: a package manifest

    {"name": "web", "version": "1.10", "scripts": {"build": "vite build"}, "private": true}

    becomes

    name: web
    version: "1.10"
    scripts:
      build: vite build
    private: true

    The version stays quoted because an unquoted 1.10 would be read back as the number 1.1.

    Why convert JSON to YAML?

    For the opposite direction use YAML to JSON; to tidy the YAML afterwards use the YAML formatter.

    JSON to YAML questions

    Is every JSON file convertible to YAML?

    Yes. YAML 1.2 is a superset of JSON, so any valid JSON can be represented in YAML; in fact valid JSON is already valid YAML. Converting simply switches to YAML's indentation-based block style, which is easier to read and edit.

    Why are some strings quoted in the YAML output?

    A string is quoted when writing it bare would change its type: "123", "true" and "null" must stay strings, and values such as "yes", "no", "on", "0755" or "22:22" are quoted because YAML 1.1 parsers would read them as booleans or numbers. Everything else is written without quotes.

    Is key order preserved?

    Yes, keys appear in the same order as in the JSON unless you tick Sort keys. Keys that look like numbers ("2", "10") also keep their order; the converter does not go through JavaScript objects, which would reorder them.

    What happens to large numbers?

    They are kept exactly. 12345678901234567890 in JSON becomes 12345678901234567890 in YAML instead of being rounded to 12345678901234567000.

    Can I convert the YAML back to JSON?

    Yes. Click Use as input on the output, or open the YAML to JSON converter. Converting back gives the same data you started with.