Menu

How to convert YAML into JSON in JavaScript

23 March 2020

When working with configuration data, its common to encounter scenarios where the data needs to be converted into another format. YAML is one of the most popular configurations file types used in modern web development.

If you are looking to convert YAML to JSON however there is no native JavaScript parsing functionality. Thankfully, a great package exists that easily facilities this conversion.

js-yaml acts as a standalone JavaScript YAML parser. It works in node.js and all major browsers. It will take a YAML file like this: