JSON to YAML
Convert JSON to YAML live — with optional lenient JSON input (comments, trailing commas, single quotes), key sorting and indentation.
About this ToolHow it works, benefits & use casesTap to collapse
Convert JSON into readable YAML, generated live as you type. Powered by the js-yaml dumper, it emits clean block-style YAML with your choice of 2- or 4-space indentation and never wraps long lines, so string values stay on one line. You can optionally sort object keys alphabetically for tidy, diff-friendly output. A lenient input mode means you do not need perfectly strict JSON: with repair enabled, single quotes, trailing commas and // or /* */ comments are accepted and normalised before conversion, and a banner confirms when lenient parsing is in effect. Invalid JSON that cannot be repaired produces a clear error message rather than a failure. The resulting YAML streams live and can be copied, downloaded as a .yaml file, or shared via URL, and the entire conversion happens in your browser with nothing uploaded.
How to Use
- 1Choose the YAML indentation, either 2 or 4 spaces.
- 2Toggle "Sort keys" for alphabetical key order, and enable "Repair (lenient)" if your JSON has comments, trailing commas or single quotes.
- 3Paste your JSON into the input panel — the YAML appears live — or click "Load example" (it matches your repair setting).
- 4Press "Convert to YAML" to validate the input.
- 5Copy the YAML, download it as output.yaml, or share it with the generated URL.
Key Benefits
- Clean block-style YAML output via the js-yaml dumper
- Selectable 2- or 4-space indentation with no line wrapping
- Optional alphabetical key sorting for stable diffs
- Lenient mode accepts comments, trailing commas and single quotes in the JSON
- Clear error messages when input cannot be parsed or repaired
- Live conversion with copy, .yaml download and shareable URLs
- Processed entirely in the browser — your data is never uploaded
Common Use Cases
- Turning a JSON config into a more human-readable YAML manifest
- Producing YAML for CI pipelines or Kubernetes from JSON data
- Converting hand-written JSON5-style snippets into valid YAML via repair mode
- Normalising key order before committing generated YAML
- Quickly translating an API JSON response into YAML for documentation
Options
Accept comments / trailing commas / single quotes
0 characters · live
Paste JSON above to see the YAML live.
Was this tool helpful?
Share Your Experience
Help others discover this tool!
Related tools
- Color ConverterConvert between HEX, RGB, HSL, and HSV
- cURL to Code ConverterConvert cURL commands to code in various languages
- JSON Path FinderFind and test JSON paths
- npm to Yarn ConverterConvert npm commands and package-lock.json to Yarn equivalents
- Postman to cURL ConverterConvert Postman requests to cURL commands
- Text to HexConvert text to hexadecimal
Yes, when you enable "Repair (lenient)". That mode tolerates comments, trailing commas and single-quoted strings, normalising the input before converting to YAML. A green banner confirms lenient parsing was applied. With repair off, the input must be strict JSON.
You can choose 2- or 4-space indentation, and the converter is configured not to wrap long lines, so even long string values stay on a single line. The output is block style rather than inline flow style for readability.

