Skip to content

JSON to YAML converter

Paste JSON. Invalid input produces an error and no YAML.

Ctrl+Enter or ⌘+Enter runs this tool immediately.

YAML indent
JSON input
YAML output

Waiting for input.

Parsing stays in this browser. Input is not uploaded or saved.

How to use this tool

  1. Paste a single JSON value. Objects, arrays, and primitives are all accepted.
  2. Choose 2-space or 4-space indentation. Multiline strings are written as YAML block scalars when that is clearer.
  3. Copy or download the YAML after the status says the conversion succeeded.

Supported formats and limitations

  • JSON has no comments, so the YAML output will not invent any.
  • Duplicate keys in one object follow the JSON parser: the last value is kept.
  • Integers larger than the safe range may already be imprecise in the JSON source. When that happens, the status includes a notice.
  • Key order follows the JSON text. Anchors and YAML tags are not added.

Examples

An array of objects

Each object becomes a YAML list item with indented keys.

[{"name":"api","port":8080},{"name":"worker","port":8081}]

A string that contains a newline

A JSON \n is a real newline and is usually written as a block scalar.

{"banner":"Line one\nLine two"}

Common errors and solutions

Unexpected end of JSON input
The value is unfinished. Close the object, array, or string, then convert again.
Expected double-quoted property name
JSON keys must be in double quotes. Remove trailing commas as well.
Unexpected token
Check for single quotes, comments, or a second value after the first one. JSON allows one value.

FAQ

Will the YAML round-trip back to the same JSON?
Values do. Spacing, comments, and the difference between 1 and 1.0 do not. JSON numbers do not record that distinction.
Can I convert several JSON values at once?
No. Paste one JSON value. A second value after the first is a syntax error.
Where is the file processed?
In this browser. The JSON is not uploaded to ConfigKit and is not written to local storage.

Related tools

  • YAML to JSON converter

    Convert YAML configuration to readable or compact JSON in the browser. Comments are dropped, and parse errors include line and column when the parser reports them.

  • JSON to TOML converter

    Convert a JSON object to TOML in the browser. Null values and mixed arrays are rejected, and invalid JSON produces no TOML.

  • JSON formatter

    Validate JSON, then pretty-print it with 2 or 4 spaces or minify it. Invalid JSON produces an error and leaves the output empty.