Category: Developer tools

JSON to YAML Converter

System ideaMissing a tool?

Convert valid JSON to YAML with indentation and optional key sorting

Paste JSON and convert it to YAML in your browser. Choose 2 or 4 spaces, optionally sort keys, copy output or download converted.yaml. No upload.

Paste JSON to convert it to YAML.

YAML
The result will appear here.

Everything on this page is processed in your browser. Nothing is uploaded.

What this tool does

This JSON to YAML converter parses pasted JSON text in the browser with JSON.parse, loads js-yaml on demand, and serializes the parsed value with js-yaml dump. The input can be a single JSON object, array or scalar value, and the field starts with a built-in sample. Output can use 2-space or 4-space indentation, and object keys can optionally be sorted alphabetically. You can copy the YAML result or download it as converted.yaml. If the input is not valid JSON, the tool shows the browser JSON parse error instead of guessing at a fix. It does not convert YAML to JSON, validate JSON Schema, Kubernetes, OpenAPI or business rules, upload files, import remote URLs or run batch conversions. It also does not provide multi-document YAML output, flow style, line-width, quoting-style or minified-output controls. JSON has no comments, so comments cannot be preserved; key order follows the parsed input unless sorting is enabled; anchors, tags, quoting and long-string folding follow js-yaml dump defaults. Pasted JSON and converted YAML stay in the browser and are not uploaded to LocalTools.

How to use it

  1. Paste valid JSON, or load the built-in sample and edit it.
  2. Choose 2-space or 4-space indentation and optionally sort object keys alphabetically.
  3. Copy the YAML or download converted.yaml; validation, uploads, batch mode and YAML-to-JSON are out of scope.

Privacy

This tool runs entirely in your browser. Your input is never uploaded, stored or shared — closing the tab removes it.

Frequently asked questions

How does this JSON to YAML converter work?
It parses pasted text with JSON.parse in the browser, then serializes the parsed value to YAML with js-yaml dump.
Can I choose the YAML indentation?
Yes. You can choose 2-space or 4-space indentation and optionally sort object keys alphabetically.
What happens if the JSON is invalid?
The tool shows the browser's JSON parse error message and does not guess at a repair.
Are comments or key order preserved?
JSON has no comments, so comments cannot be preserved. Key order follows the parsed input unless alphabetical sorting is enabled.
Is my JSON uploaded?
No. Pasted JSON and converted YAML stay in your browser and are not uploaded to LocalTools.