Free online tool
Free Online JSON to YAML Converter
Convert JSON to YAML online for free. Produces clean block-style YAML with 2-space indentation. Preserves key order exactly. JSON parse errors show the error position. 100% client-side — no signup required.
01How it works
Paste your JSON
Paste any valid JSON object or array. Parse errors are shown with the error position.
Click Convert
The JSON is parsed and serialised as clean, readable block-style YAML with 2-space indentation.
Copy or download
Copy the YAML to clipboard or download it as output.yaml.
FAQ
Frequently asked questions
What indentation and style does the YAML output use?
The converter uses js-yaml's dump function in block style with 2-space indentation. All nested objects and arrays are written in block form (one key per line). Flow style (inline {}) is not used by default, keeping the output readable for large nested structures.
Does it preserve the key order from the JSON?
JSON key order is preserved in the YAML output. JavaScript objects maintain insertion order for string keys (ES2015+), and js-yaml's dump respects that order. Keys are not sorted alphabetically unless they were already sorted in the JSON.
Why does my JSON with trailing commas fail to convert?
Standard JSON does not allow trailing commas, comments, or single-quoted strings. If your input has those (it is JSONC or JSON5, not JSON), you will get a parse error. Remove trailing commas and comments before converting. For JSONC, strip comments first using the JSON Formatter tool.
How are JSON null, true, false, and empty collections handled in YAML?
JSON null values become YAML null. JSON true/false become YAML true/false. JSON numbers stay as numbers. Empty arrays [] become [] in YAML. Empty objects {} become {} in YAML. These are all valid YAML values that round-trip back to identical JSON.
Need AI-powered document extraction?
This tool uses client-side processing. anyrow uses AI to extract structured data from PDFs, images, and scanned documents with 99% accuracy. 150 free extractions/month — no credit card required.