JSON to YAML Converter
Switch configuration between JSON and YAML in either direction.
INPUT
CHARS: 0WORDS: 0LINES: 0
OUTPUT
CHARS: 0WORDS: 0LINES: 0
How the JSON to YAML Converter works
JSON is parsed strictly and written out as YAML with block style mappings and lists, without line wrapping, so long strings stay on one line. In the other direction the YAML is parsed and printed as indented JSON.
YAML features that JSON cannot express, such as comments and anchors, are lost when converting to JSON. Multi document YAML files should be converted one document at a time.
JSON to YAML Converter examples
Convert JSON configuration to clean YAML
Input
{"server":{"port":8080,"host":"localhost","debug":true}}Result
server: port: 8080 host: localhost debug: true
When it is useful
- •Converting an OpenAPI or Kubernetes manifest between formats.
- •Moving settings from a JSON config to a YAML based tool.
- •Checking what a YAML file looks like as plain data.
- •Producing a readable version of a large JSON payload.
Frequently Asked Questions
Are comments preserved?
No. JSON has no comments, so they are dropped when YAML becomes JSON. Converting JSON to YAML cannot add them either.
Why does YAML sometimes turn strings into numbers?
Unquoted values like 1.0, yes, no and null have special meaning in YAML. The converter quotes strings that would otherwise be misread.
Which indentation should I use?
Two spaces is the convention in Kubernetes and most CI files. YAML forbids tabs for indentation.
Related tools
- JSON Formatter and MinifierPaste JSON to validate it and print it neatly, or compress it to a single line.
- YAML FormatterCheck your YAML parses, and print it with consistent indentation.
- CSV to JSON ConverterPaste CSV and get an array of JSON objects, or an array of arrays if there is no header.
- JSON Stringify TextPaste text, get a string literal that is safe to place inside JSON.
- XML FormatterPaste XML to check it and lay it out with clear indentation.