Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

js-yaml

Read and write YAML files in JavaScript.

UtilitiesNPM

GitHubWebsite

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/LICENSE

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

73 / 100
Gid Score, #262 overall
409M
downloads a week, npm
6,641
GitHub stars
143
agent projects use it
js-yaml: downloads per weeknpm, js-yaml 409,452,192
js-yaml: GitHub starsnodeca/js-yaml 6,641

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

87 projects, 2.7%
76 projects, 2.5%
47 projects, 1.9%
21 projects, 4.4%
17 projects, 3.6%
12 projects, 3.6%
7 projects, 2.0%
5 projects, 3.6%

Often used with

In 49.0% of its projects
In 60.8% of its projects
In 72.7% of its projects
In 22.4% of its projects
In 21.0% of its projects
In 22.4% of its projects
In 27.3% of its projects

More about js-yaml

Funding
  • GitHub Sponsors: https://github.com/puzrin
  • GitHub Sponsors: https://github.com/nodeca
  • 2 GitHub sponsors

See all

Head to head
More in Utilities

Alternatives

js-yaml This page

MITGid 73409M/wk

yaml

Pick the yaml package when you must edit a YAML file and keep its comments and blank lines.

ISCGid 7033M/wk

PyYAML

Pick PyYAML when your code is Python rather than JavaScript.

Compare js-yaml with another tool

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.”

  1. Add the package to your project.

    npm install js-yaml

    From github.com/nodeca/js-yaml/blob/master/README.md

  2. Read 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)
    }
    

    From github.com/nodeca/js-yaml/blob/master/README.md

  3. Write data as YAML text with dump().

    import { dump } from 'js-yaml'
    
    const source = dump({ greeting: 'hello' })
    console.log(source)
    

    From github.com/nodeca/js-yaml/blob/master/README.md

Mistakes to avoid

import yaml from 'js-yaml'; yaml.load(text)
import { load, dump } from 'js-yaml' (or import * as yaml from 'js-yaml' to keep yaml.load calls)

Version 5 has no default export on purpose.

yaml.safeLoad(text) / yaml.safeDump(obj)
load(text) / dump(obj); they are the safe versions

The safe* names were renamed in version 4 and removed in version 5.

load(text) on a file that uses <<: *base merge keys
load(text, { schema: CORE_SCHEMA.withTags(mergeTag) })

Merge keys are off by default in version 5; in our run the object kept a literal "<<" key instead of merging.

Expecting dates to become Date objects and yes/no to become true/false (version 4 habits)
Parse dates yourself, or pass { schema: YAML11_SCHEMA } if you need the old YAML 1.1 types

Version 5 uses YAML 1.2 rules; in our run "when: 2026-11-10" stayed a string and "country: no" stayed "no".

version: 1.10 or zip: 012345 written without quotes
Quote values that must stay text: version: '1.10', zip: '012345'

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.