JSON / YAML Converter

Convert JSON to YAML and YAML to JSON side by side in your browser. Set the indent size, array indentation and key sorting, then copy or download. Parse errors show the line and column, so broken Kubernetes manifests or config files are easy to fix.

About this tool

What does this converter do?

JSON and YAML describe the same kinds of data (objects, arrays, strings, numbers, booleans and null) with different syntax. JSON is common in APIs; YAML is popular for configuration such as Kubernetes manifests, Docker Compose files and CI pipelines. This tool shows a JSON editor and a YAML editor next to each other and converts in either direction.

How to use

  1. Paste JSON into the left JSON editor, or YAML into the right YAML editor. You can also drop a file onto either editor.
  2. Set Indent size (1–16 spaces). Optionally uncheck Array indent or check Sort keys.
  3. Click To YAML to convert the left side into the right, or To JSON to convert the right side into the left.
  4. Use the Copy to clipboard or Download button on the output editor. Dropped files keep their name; otherwise the file gets a .json or .yaml extension.

Features

  • Two-way conversion between JSON and YAML in one view
  • Indent size applies to both the YAML and the JSON output
  • Array indent: indent - list items under their parent key, or keep them aligned with it
  • Sort keys: sort object keys alphabetically in the YAML output
  • Error positions: syntax errors report the line and column
  • Byte size of each side is shown under the editors

Example

To YAML with indent size 2:

With Array indent unchecked, the list items start at the same column as ports:.

What changes during conversion

  • Comments in YAML are dropped, because JSON has no comments.
  • Anchors and aliases (&ref / *ref) are expanded into full copies.
  • Dates such as 2024-01-01 become ISO 8601 strings like "2024-01-01T00:00:00.000Z" in JSON.
  • Large integers beyond 2^53 may lose precision.
  • Multiple documents separated by --- cannot be converted at once; convert one document at a time.

FAQ

Is my data uploaded?

No. Both directions are converted in your browser with the js-yaml library; nothing is sent to a server.

Are yes and no converted to booleans?

No. The parser follows YAML 1.2, where only true and false are booleans. yes, no, on and off stay strings.

Why does To JSON fail with "expected a single document"?

The YAML contains more than one document separated by ---. Remove the extra documents or convert them one by one.