1. License
“to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software”
MIT allows use in paid and closed-source apps.
github.com/nodeca/js-yaml/blob/master/LICENSE2. Maintained
github.com/nodeca/js-yaml3. Used by agents' projects
Dependency in 143 public GitHub projects set up for AI coding agents that we scanned (2.3%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily; card checked Nov 10, 2026. Tap a verdict to see its source.How we checkedReport an error
What js-yaml does
js-yaml is a free JavaScript library that turns YAML text, the format of many settings files, into data your app can use, and turns data back into YAML. It works in Node.js and in the browser. Version 5 changed several defaults, so older examples can mislead.
What people build with it
Read a settings file
Your app keeps its name, port and options in config.yml; it reads the file at start and stops with a clear message if the file is broken.
Write data out as YAML
Your tool creates a settings file, a workflow file or an export that people will read and edit by hand.
Files with several documents
A deployment file holds several blocks split by --- lines; read them all as a list.
Accept YAML that users upload
People paste or upload settings into your app; limit the size and treat any reading error as a rejected file.
Settings at the top of blog posts Idea
Markdown posts start with a short YAML block for title, date and tags; read it to build the post list.
A YAML to JSON converter page Idea
A small page in your app turns pasted YAML into JSON and back, running fully in the visitor's browser.
js-yaml popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How js-yaml is used
- js-yaml is a dependency in 143 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (2.9% of the 4,867 JavaScript/TypeScript ones), #6 of 408 in utilities.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 355; those are left out of every share on this page.
- The most used alternative in our scan is yaml (214 projects).
- Projects that use it most often also use Prettier (49.0%), Model Context Protocol SDK (JavaScript) (32.2%), ESLint (60.8%).
By coding agent
Often used with
More about js-yaml
Funding
- GitHub Sponsors: https://github.com/puzrin
- GitHub Sponsors: https://github.com/nodeca
- 2 GitHub sponsors
Head to head
- yaml vs js-yaml used together in 13 projects
Alternatives
js-yaml This page
Pick the yaml package when you must edit a YAML file and keep its comments and blank lines.
Pick PyYAML when your code is Python rather than JavaScript.
Get started
Tell your AI assistant
“Use js-yaml 5.5.0 with named imports (import { load, dump } from 'js-yaml') to read config.yml with load(text, { filename }) inside try/catch, and add CORE_SCHEMA.withTags(mergeTag) if the file uses << merge keys.”
Add the package to your project.
npm install js-yamlRead YAML text with load() inside try/catch.
import { load } from 'js-yaml' try { const document = load('greeting: hello') console.log(document.greeting) } catch (e) { console.error(e) }Write data as YAML text with dump().
import { dump } from 'js-yaml' const source = dump({ greeting: 'hello' }) console.log(source)
Mistakes to avoid
Version 5 has no default export on purpose.
The safe* names were renamed in version 4 and removed in version 5.
Merge keys are off by default in version 5; in our run the object kept a literal "<<" key instead of merging.
Version 5 uses YAML 1.2 rules; in our run "when: 2026-11-10" stayed a string and "country: no" stayed "no".
Unquoted they are read as numbers; in our run they became 1.1 and 12345.
Questions
Where did safeLoad go?
It was removed in version 5. load() has been the safe default since version 4, so call load() instead.
Why does import yaml from 'js-yaml' fail?
Version 5 has no default export. Use import { load, dump } from 'js-yaml', or import * as yaml from 'js-yaml'.
Can it run in the browser?
Yes. Browser builds are published under js-yaml/browser.
My << merge keys stopped working after an upgrade. Why?
Version 5 leaves merge keys off by default. Turn them on with CORE_SCHEMA.withTags(mergeTag).
Is the project maintained?
Yes. Version 5.5.0 came out on 2026-10-16, after the 5.0.0 rewrite in June 2026.