YAML to JSON
Parse YAML with the yaml package and serialize the resulting value as two-space JSON.
How to use
- Enter YAML and run to inspect the JSON output.
Capabilities and scope
YAML-specific syntax is converted into the JSON data model represented by JSON.stringify.
How it works
It evaluates YAML.parse(input) and then JSON.stringify(value,null,2).
Example
name: Murelio becomes an object containing the name property.
Useful for
- Move configuration data from YAML into JSON
Before you use it
- YAML comments and anchor syntax are not preserved as syntax in the JSON output, and values outside the JSON data model can have limitations.
Frequently asked questions
Are YAML comments retained?
No. Only parsed data values are serialized.