Convert YAML to JSON
Turn YAML files into JSON. The same structure and key order, with several documents as a list, aliases expanded and comments dropped.
Converted in an isolated sandbox on our serversDeleted after 24 hours
Drop YAML files on the dialor turn it to pick what to do
YAML data as plain JSON.The structure and key order stay the same. Comments are dropped.
What you get
One JSON file with the same structure and key order as the YAML. A file with several documents becomes a list, with one entry for each document.
Aliases are expanded, so each place that pointed to an anchor holds its own copy of the value.
What changes
Comments are dropped, because JSON has no place for them.
Values such as yes, on, 0755 and dates stay text. They are not turned into booleans, numbers or dates.
A merge key (<<) is kept as an ordinary key. Its contents are not merged into the mapping around it.
When it fails
If the file cannot be parsed, the conversion stops with
input_corrupted. The YAML has to be readable before it can become JSON.To go the other way, use JSON to YAML.
YAML and JSON.What each format is.
The formats
YAML
YAML configuration and data files.
- Extensions
- .yaml .yml
- MIME type
- application
/yaml - Kind
- Text and data
JSON
JSON, the data format of every API.
- Extensions
- .json
- MIME type
- application
/json - Kind
- Text and data
In your code.The same YAML to JSON conversion through the API, for your app or your agent.
$ cv convert report.yaml report.json$ cv convert report.yaml report.jsonQuestions.What people ask about YAML to JSON.
Yes. The JSON has the same structure and key order as the YAML.
The documents become a list in one JSON file.
No. Values such as yes, on, 0755 and dates stay text.
Comments are dropped. Aliases are expanded into copies of the values they point to.