How to convert YML to JSON
- Add your .YML file - drop it in the box above or click to browse.
- Convert it to .JSON in a few seconds.
- Download your new .JSON file.
What to expect
- YAML
# commentsare silently dropped - JSON has no comment syntax, so any inline documentation in your.ymlfile will not appear in the output. - YAML anchors (
&anchor) and aliases (*alias) are expanded: the JSON output repeats the full value at each reference point, which can increase file size. - Unquoted
yes,no,on, andoffare YAML booleans and will becometrueorfalsein JSON - quote them in the source.ymlif you need the literal strings.
Frequently asked questions
Is YML-to-JSON conversion lossless?
For data, yes - all keys, values, lists, and nested objects convert exactly. YAML comments are the only thing dropped, because JSON has no comment syntax.
What happens to YAML anchors and aliases?
They are expanded: each alias is replaced with the full value it references, so the JSON output is correct but may be larger than the source
.yml.My YAML uses yes/no instead of true/false - will that cause problems?
Both
yes and no are parsed as YAML booleans and will appear as true and false in JSON - quote them in the .yml source if you need the literal strings.Can I convert JSON back to YML?
Yes -
yq -o=yaml file.json > file.yml reverses the process, and the round-trip is lossless since JSON is a subset of YAML.