YAML 1.2 parser and serializer for JavaScript.
- Supports the YAML 1.2 and YAML 1.1 specifications.
- Passes the entire YAML Test Suite.
Note
If you are upgrading from v4, see the v5 migration guide.
npm install js-yamlimport { load } from 'js-yaml'
try {
const document = load('greeting: hello')
console.log(document.greeting)
} catch (e) {
console.error(e)
}import { dump } from 'js-yaml'
const source = dump({ greeting: 'hello' })
console.log(source)