{
 "kind": "tool",
 "slug": "js-yaml",
 "path": "tools/js-yaml/",
 "name": "js-yaml",
 "maker": null,
 "density": "full",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Utilities",
   "tools/utilities/"
  ]
 ],
 "lead": "Read and write YAML files in JavaScript.",
 "chips": [
  {
   "label": "Utilities",
   "path": "tools/utilities/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install js-yaml"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/nodeca/js-yaml"
  },
  {
   "label": "Website",
   "href": "https://github.com/nodeca/js-yaml#readme"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "MIT",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software",
   "note": "MIT allows use in paid and closed-source apps.",
   "src": "https://github.com/nodeca/js-yaml/blob/master/LICENSE"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Oct 27, 2026",
   "note": "",
   "src": "https://github.com/nodeca/js-yaml"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "143 projects",
   "status": "info",
   "sub": "#6 of 408 in its category",
   "note": "Dependency in 143 public GitHub projects set up for AI coding agents that we scanned (2.3%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Install only",
   "status": "info",
   "sub": null,
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": null
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily; card checked Nov 10, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What js-yaml does",
   "parts": [
    {
     "t": "prose",
     "text": "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."
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Read a settings file",
       "text": "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.",
       "idea": false
      },
      {
       "title": "Write data out as YAML",
       "text": "Your tool creates a settings file, a workflow file or an export that people will read and edit by hand.",
       "idea": false
      },
      {
       "title": "Files with several documents",
       "text": "A deployment file holds several blocks split by --- lines; read them all as a list.",
       "idea": false
      },
      {
       "title": "Accept YAML that users upload",
       "text": "People paste or upload settings into your app; limit the size and treat any reading error as a rejected file.",
       "idea": false
      },
      {
       "title": "Settings at the top of blog posts",
       "text": "Markdown posts start with a short YAML block for title, date and tags; read it to build the post list.",
       "idea": true
      },
      {
       "title": "A YAML to JSON converter page",
       "text": "A small page in your app turns pasted YAML into JSON and back, running fully in the visitor's browser.",
       "idea": true
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "js-yaml popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "73",
       "of": "/ 100",
       "l": "Gid Score, #262 overall"
      },
      {
       "n": "409M",
       "l": "downloads a week, npm"
      },
      {
       "n": "6,641",
       "l": "GitHub stars"
      },
      {
       "n": "143",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How js-yaml is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "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%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "87 projects, 2.7%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "76 projects, 2.5%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "47 projects, 1.9%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "21 projects, 4.4%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "17 projects, 3.6%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      },
      {
       "l": "12 projects, 3.6%",
       "v": "OpenClaw",
       "path": "agents/openclaw/"
      },
      {
       "l": "7 projects, 2.0%",
       "v": "OpenCode",
       "path": "agents/opencode/"
      },
      {
       "l": "5 projects, 3.6%",
       "v": "Kiro",
       "path": "agents/kiro/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 49.0% of its projects",
       "v": "Prettier",
       "path": "tools/prettier/"
      },
      {
       "l": "In 32.2% of its projects",
       "v": "Model Context Protocol SDK (JavaScript)",
       "path": "tools/modelcontextprotocol/"
      },
      {
       "l": "In 60.8% of its projects",
       "v": "ESLint",
       "path": "tools/eslint/"
      },
      {
       "l": "In 72.7% of its projects",
       "v": "TypeScript",
       "path": "tools/typescript/"
      },
      {
       "l": "In 22.4% of its projects",
       "v": "Ajv",
       "path": "tools/ajv/"
      },
      {
       "l": "In 21.0% of its projects",
       "v": "esbuild",
       "path": "tools/esbuild/"
      },
      {
       "l": "In 22.4% of its projects",
       "v": "Express",
       "path": "tools/express/"
      },
      {
       "l": "In 27.3% of its projects",
       "v": "Husky",
       "path": "tools/husky/"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "usage",
   "h2": "More about js-yaml",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Funding",
       "path": "tools/funding/",
       "items": [
        "GitHub Sponsors: https://github.com/puzrin",
        "GitHub Sponsors: https://github.com/nodeca",
        "2 GitHub sponsors"
       ]
      },
      {
       "title": "Head to head",
       "items": [
        {
         "text": "yaml vs js-yaml",
         "note": "used together in 13 projects",
         "path": "tools/compare/yaml-vs-js-yaml/"
        }
       ]
      },
      {
       "title": "More in Utilities",
       "path": "tools/utilities/",
       "items": [
        {
         "text": "clsx",
         "path": "tools/clsx/"
        },
        {
         "text": "date-fns",
         "path": "tools/date-fns/"
        },
        {
         "text": "PyYAML",
         "path": "tools/pyyaml/"
        },
        {
         "text": "uuid",
         "path": "tools/uuid/"
        },
        {
         "text": "glob",
         "path": "tools/glob/"
        },
        {
         "text": "Lodash",
         "path": "tools/lodash/"
        },
        {
         "text": "tqdm",
         "path": "tools/tqdm/"
        },
        {
         "text": "Nanoid (JavaScript)",
         "path": "tools/nanoid-npm/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "js-yaml",
       "me": true,
       "facts": [
        "MIT",
        "Gid 73",
        "409M/wk"
       ]
      },
      {
       "name": "yaml",
       "why": "Pick the yaml package when you must edit a YAML file and keep its comments and blank lines.",
       "path": "tools/yaml/",
       "facts": [
        "ISC",
        "Gid 70",
        "33M/wk"
       ]
      },
      {
       "name": "PyYAML",
       "why": "Pick PyYAML when your code is Python rather than JavaScript.",
       "path": "tools/pyyaml/",
       "facts": []
      }
     ],
     "more": "Compare js-yaml with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "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."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Add the package to your project.",
       "code": "npm install js-yaml",
       "src": "https://github.com/nodeca/js-yaml/blob/master/README.md"
      },
      {
       "text": "Read YAML text with load() inside try/catch.",
       "code": "import { load } from 'js-yaml'\n\ntry {\n  const document = load('greeting: hello')\n  console.log(document.greeting)\n} catch (e) {\n  console.error(e)\n}\n",
       "src": "https://github.com/nodeca/js-yaml/blob/master/README.md"
      },
      {
       "text": "Write data as YAML text with dump().",
       "code": "import { dump } from 'js-yaml'\n\nconst source = dump({ greeting: 'hello' })\nconsole.log(source)\n",
       "src": "https://github.com/nodeca/js-yaml/blob/master/README.md"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "import yaml from 'js-yaml'; yaml.load(text)",
       "fix": "import { load, dump } from 'js-yaml' (or import * as yaml from 'js-yaml' to keep yaml.load calls)",
       "why": "Version 5 has no default export on purpose."
      },
      {
       "dont": "yaml.safeLoad(text) / yaml.safeDump(obj)",
       "fix": "load(text) / dump(obj); they are the safe versions",
       "why": "The safe* names were renamed in version 4 and removed in version 5."
      },
      {
       "dont": "load(text) on a file that uses <<: *base merge keys",
       "fix": "load(text, { schema: CORE_SCHEMA.withTags(mergeTag) })",
       "why": "Merge keys are off by default in version 5; in our run the object kept a literal \"<<\" key instead of merging."
      },
      {
       "dont": "Expecting dates to become Date objects and yes/no to become true/false (version 4 habits)",
       "fix": "Parse dates yourself, or pass { schema: YAML11_SCHEMA } if you need the old YAML 1.1 types",
       "why": "Version 5 uses YAML 1.2 rules; in our run \"when: 2026-11-10\" stayed a string and \"country: no\" stayed \"no\"."
      },
      {
       "dont": "version: 1.10 or zip: 012345 written without quotes",
       "fix": "Quote values that must stay text: version: '1.10', zip: '012345'",
       "why": "Unquoted they are read as numbers; in our run they became 1.1 and 12345."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Where did safeLoad go?",
       "a": "It was removed in version 5. load() has been the safe default since version 4, so call load() instead.",
       "evidence": {
        "url": "https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md",
        "quote": "Removed deprecated safeLoad(), safeLoadAll() and safeDump() exports."
       }
      },
      {
       "q": "Why does import yaml from 'js-yaml' fail?",
       "a": "Version 5 has no default export. Use import { load, dump } from 'js-yaml', or import * as yaml from 'js-yaml'.",
       "evidence": {
        "url": "https://github.com/nodeca/js-yaml/blob/master/docs/migrate_v4_to_v5.md",
        "quote": "js-yaml v5 does not provide an ESM default export by design."
       }
      },
      {
       "q": "Can it run in the browser?",
       "a": "Yes. Browser builds are published under js-yaml/browser.",
       "evidence": {
        "url": "https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md",
        "quote": "Moved browser builds to the js-yaml/browser export."
       }
      },
      {
       "q": "My << merge keys stopped working after an upgrade. Why?",
       "a": "Version 5 leaves merge keys off by default. Turn them on with CORE_SCHEMA.withTags(mergeTag).",
       "evidence": {
        "url": "https://github.com/nodeca/js-yaml/blob/master/docs/migrate_v4_to_v5.md",
        "quote": "In practice the most common compatibility difference is the missing !!merge (<<) feature, which is easy to add back"
       }
      },
      {
       "q": "Is the project maintained?",
       "a": "Yes. Version 5.5.0 came out on 2026-10-16, after the 5.0.0 rewrite in June 2026.",
       "evidence": {
        "url": "https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md",
        "quote": "[5.0.0] - 2026-06-20"
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm js-yaml"
  ],
  [
   "Category",
   "Utilities"
  ],
  [
   "License",
   "MIT"
  ],
  [
   "Gid Score",
   "73.2"
  ],
  [
   "Rank in category",
   "#6 of 408"
  ],
  [
   "GitHub",
   "nodeca/js-yaml"
  ],
  [
   "Last change",
   "Oct 27, 2026"
  ]
 ],
 "good": [
  "Broken files make load() stop with an error, so your code must catch it.",
  "A tiny file can expand into a huge object through repeated references. For files from strangers, limit the size and count items before using the data.",
  "Since version 5, an empty file is an error for load(); loadAll() still returns an empty list."
 ],
 "checked_line": "Read by AgentGid from 11 official pages, card checked Nov 10, 2026; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/nodeca.png"
}