Skip to content

JSON to YAML

Convert between JSON and YAML in both directions.

INDENT SIZE:
OUTPUT:
0 chars

Convert in either direction

  1. [01]

    Paste JSON or YAML into the INPUT pane, or click [SAMPLE] to load a demo document.

  2. [02]

    Choose INDENT SIZE: 2 spaces or 4 spaces.

  3. [03]

    Click [JSON → YAML] or [YAML → JSON] to validate and convert.

  4. [04]

    Use [copy] to take the result, or [SWAP] to move it back into the input for the reverse conversion.

// A worked conversion

IN

{"name":"John","age":30,"tags":["dev","ops"]}

OUT

name: John age: 30 tags: - dev - ops

Arrays become dash lists and scalar types are preserved. The converter also adds a trailing newline to the YAML output.

// Options and parsing notes

  • >[JSON → YAML] — Requires strict JSON. JSON.parse runs first, then the yaml library writes the value with the chosen indent.
  • >[YAML → JSON] — Parses YAML and writes standard JSON with the same indent setting.
  • >2 spaces / 4 spaces — Controls indentation in both directions. Editing the input clears the old result; click a direction button to convert again.
  • >[SWAP] — Moves the output back into INPUT, which is handy for converting it back the other way.
  • >YAML 1.2 scalars — Words such as yes, no, on and off are parsed as strings, not booleans.
  • >Processing — Both conversions run in this browser tab. The page sends no request containing your data.

// Where to go next

  • >JSON Formatter — read the converted JSON as a tree or edit a value in place
  • >JSON Diff — compare the converted file with an earlier version