{
 "kind": "tool",
 "slug": "yaml",
 "path": "tools/yaml/",
 "name": "yaml",
 "maker": null,
 "density": "full",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Utilities",
   "tools/utilities/"
  ]
 ],
 "lead": "Read, write and edit YAML files in JavaScript.",
 "chips": [
  {
   "label": "Utilities",
   "path": "tools/utilities/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install yaml"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/eemeli/yaml"
  },
  {
   "label": "Website",
   "href": "https://eemeli.org/yaml/"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "ISC",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": "Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.",
   "note": "ISC allows any use, with or without a fee.",
   "src": "https://github.com/eemeli/yaml/blob/v2.9.1/LICENSE"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Sep 23, 2026",
   "note": "Latest GitHub release Sep 11, 2026. ",
   "src": "https://github.com/eemeli/yaml"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "214 projects",
   "status": "info",
   "sub": "#5 of 408 in its category",
   "note": "Dependency in 214 public GitHub projects set up for AI coding agents that we scanned (3.4%).",
   "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 yaml does",
   "parts": [
    {
     "t": "prose",
     "text": "yaml is a free JavaScript library that reads and writes YAML, the plain-text format many settings files are written in. Your app or script can load such a file, change one value and save it back with the comments people wrote still in place. It works in Node.js and in modern browsers."
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Load a settings file",
       "text": "A Node.js script or server reads its settings from a YAML file and gets plain JavaScript objects and lists back.",
       "idea": false
      },
      {
       "title": "Change a value, keep the comments",
       "text": "Your tool bumps a port or a version number in a hand-written settings file, and the notes people left in it stay where they were.",
       "idea": false
      },
      {
       "title": "Save app data as a readable file",
       "text": "An export button or a generator script writes settings or content as YAML that a person can open and edit by hand.",
       "idea": false
      },
      {
       "title": "Point to the broken line",
       "text": "When a person pastes or uploads a broken settings file, your app shows which line and column are wrong instead of a vague failure.",
       "idea": false
      },
      {
       "title": "Read older files the old way",
       "text": "Files written for older tools treat words like yes, no and on as true or false; you can tell yaml to read them by the older rules.",
       "idea": false
      },
      {
       "title": "A settings editor in the browser",
       "text": "An admin page lets people edit a YAML settings file right in the browser and checks it before saving, with no server step.",
       "idea": true
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "yaml popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "70",
       "of": "/ 100",
       "l": "Gid Score, #385 overall"
      },
      {
       "n": "33M",
       "l": "downloads a week, npm"
      },
      {
       "n": "1,705",
       "l": "GitHub stars"
      },
      {
       "n": "214",
       "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 yaml is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "yaml is a dependency in 214 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (4.4% of the 4,867 JavaScript/TypeScript ones), #5 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 607; those are left out of every share on this page.",
      "The most used alternative in our scan is js-yaml (143 projects).",
      "Projects that use it most often also use Vitest (63.6%), tsx (52.8%), TypeScript (88.8%).",
      "It is more common in projects set up for OpenClaw (15.0%) than for Cursor (2.6%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "171 projects, 5.2%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "92 projects, 3.0%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "63 projects, 2.6%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "50 projects, 15.0%",
       "v": "OpenClaw",
       "path": "agents/openclaw/"
      },
      {
       "l": "36 projects, 7.6%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "33 projects, 7.0%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      },
      {
       "l": "21 projects, 6.1%",
       "v": "OpenCode",
       "path": "agents/opencode/"
      },
      {
       "l": "10 projects, 3.6%",
       "v": "Devin Desktop",
       "path": "agents/devin-desktop/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 63.6% of its projects",
       "v": "Vitest",
       "path": "tools/vitest/"
      },
      {
       "l": "In 52.8% of its projects",
       "v": "tsx",
       "path": "tools/tsx/"
      },
      {
       "l": "In 88.8% of its projects",
       "v": "TypeScript",
       "path": "tools/typescript/"
      },
      {
       "l": "In 33.6% of its projects",
       "v": "Model Context Protocol SDK (JavaScript)",
       "path": "tools/modelcontextprotocol/"
      },
      {
       "l": "In 29.0% of its projects",
       "v": "chalk",
       "path": "tools/chalk/"
      },
      {
       "l": "In 54.2% of its projects",
       "v": "Zod",
       "path": "tools/zod/"
      },
      {
       "l": "In 28.0% of its projects",
       "v": "ws",
       "path": "tools/ws/"
      },
      {
       "l": "In 27.6% of its projects",
       "v": "Commander",
       "path": "tools/commander/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "yaml in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Comments and blank lines survive",
       "v": "The README lists support for parsing, modifying and writing YAML comments and blank lines among the library's core features."
      },
      {
       "l": "Passes the yaml-test-suite, per the maintainers",
       "v": "The README claims support for YAML 1.1 and 1.2 with all common data schemas. It also claims the library passes every test in the yaml-test-suite."
      },
      {
       "l": "Three depths of API",
       "v": "According to the README, the first layer \"just works\" and the second adds \"all the bells and whistles supported by the library\". The third gets progressively closer to the YAML source."
      },
      {
       "l": "Familiar JSON-style entry point",
       "v": "The README says <code>parse</code> and <code>stringify</code> work like their JSON counterparts \"as far as possible\". They also take reviver and replacer arguments."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "parse() throws and takes one document",
       "v": "The docs say <code>YAML.parse</code> throws on error and may log warnings with <code>console.warn</code>. It only accepts a single YAML document. For multi-document input, use <code>parseAllDocuments</code>."
      },
      {
       "l": "Unrendered {{ }} templates come back mangled, with no error",
       "v": "FormatArc reports that a Helm-style value starting with <code>{{</code> produced no error in eemeli/yaml. The parser silently returned a mangled object. The post gives two fixes: quote the whole value, or validate only after the template is rendered."
      },
      {
       "l": "README and docs site disagree",
       "v": "The README says the minimum TypeScript version for the typings is 5.9. The docs site says 3.9. The README says the library accepts \"any string\" without throwing, while the site says \"nearly any string\". The README installs <code>yaml@next</code> with <code>--save-exact</code>, and the site uses plain <code>npm install yaml</code>."
      }
     ]
    },
    {
     "t": "h3",
     "text": "parse and stringify, from the README"
    },
    {
     "t": "tabs",
     "label": "Example",
     "items": [
      {
       "tab": "Js",
       "code": "import { parse, stringify } from 'yaml'\n\nparse('[ true, false, maybe, null, 3.14159 ]')\n// [ true, false, 'maybe', null, 3.14159 ]\n\nstringify([true, false, 'maybe', null, 3.14159])\n// `- true\n// - false\n// - maybe\n// - null\n// - 3.14159\n// `\n\nstringify({ number: 3, plain: 'string', block: 'two\\nlines\\n' })\n// `number: 3\n// plain: string\n// block: |\n//   two\n//   lines\n// `"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about yaml",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Funding",
       "path": "tools/funding/",
       "items": [
        "GitHub Sponsors: https://github.com/eemeli",
        "Tidelift: https://tidelift.com/funding/github/npm/yaml",
        "4 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": "Packages around it",
       "items": [
        "vitest: Test runner",
        "tsx: Run TypeScript in Node",
        "typescript: Typed JavaScript compiler",
        "zod: Schema validation",
        "@modelcontextprotocol: MCP SDK",
        "chalk: Terminal colors"
       ]
      },
      {
       "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": "yaml",
       "me": true,
       "facts": [
        "ISC",
        "Gid 70",
        "33M/wk"
       ]
      },
      {
       "name": "js-yaml",
       "why": "Pick js-yaml when you only need to read and write YAML in JavaScript and do not need to keep comments when you save.",
       "path": "tools/js-yaml/",
       "facts": [
        "MIT",
        "Gid 73",
        "409M/wk"
       ]
      },
      {
       "name": "PyYAML",
       "why": "Pick PyYAML when your code is in Python rather than JavaScript.",
       "path": "tools/pyyaml/",
       "facts": []
      },
      {
       "name": "gray-matter",
       "why": "Pick gray-matter when the YAML sits at the top of Markdown files, such as blog posts, and you need both parts.",
       "path": "tools/gray-matter/",
       "facts": []
      }
     ],
     "more": "Compare yaml with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "Use the npm package yaml (pin yaml@2.9.1, Node.js 14.6+) to read config.yml with parseDocument, change the value with doc.setIn, and write doc.toString() back so the comments stay; catch YAMLParseError and show its line and column."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Add the package to your project (version 2; the GitHub front page already describes the next major version).",
       "code": "npm install yaml",
       "src": "https://github.com/eemeli/yaml/blob/v2.9.1/README.md"
      },
      {
       "text": "Import parse and stringify; they work like the built-in JSON functions.",
       "code": "import { parse, stringify } from 'yaml'",
       "src": "https://eemeli.org/yaml/"
      },
      {
       "text": "To edit a file and keep its comments, parse it as a document instead.",
       "code": "import { parseDocument } from 'yaml'",
       "src": "https://eemeli.org/yaml/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## yaml\n- Use `parse` / `stringify` from `yaml` for plain reads and writes. Reviver and replacer arguments follow the JSON implementation.\n- Handle errors around `YAML.parse`: it throws on error and may log warnings with `console.warn`.\n- Use `parseAllDocuments` for input with more than one YAML document. `parse` only supports a single document.\n- To write a stream of documents, call `stringify` once per document value and join the results with `...\\n`. Each `stringify` result already ends with `\\n`.\n- Pass one options object to every call, since option categories do not overlap. Use `intAsBigInt: true` to get BigInt integers, or `schema: 'failsafe'` to keep scalars as strings.\n- Do not rely on undocumented internals. They may change between minor versions.\n- If the bundled typings fail on an older TypeScript compiler, set `skipLibCheck: true`.\n"
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "Following the GitHub main-branch README (npm install --save-exact yaml@next) in a project on yaml 2",
       "fix": "npm install yaml (2.9.1) and read the yaml@2 documentation site linked from the package",
       "why": "The main branch already describes the version 3 prerelease, which needs a newer Node.js."
      },
      {
       "dont": "stringify(parse(file)) to change one value in a hand-written config",
       "fix": "parseDocument(file), doc.setIn([...], value), then doc.toString()",
       "why": "parse returns plain data without comments; the Document keeps them (our demo kept both comments)."
      },
      {
       "dont": "Expecting yes, no, on or NO to come back as true or false (old YAML 1.1 habit)",
       "fix": "Write true or false in the file, or parse with { version: '1.1' } for old files",
       "why": "Default rules are YAML 1.2; in our run NO stayed \"NO\" and became false only with version: '1.1'."
      },
      {
       "dont": "parse() on a file with several documents separated by ---",
       "fix": "parseAllDocuments(file) and read each document",
       "why": "parse supports one document per input."
      },
      {
       "dont": "Setting maxAliasCount to -1 for files that users upload",
       "fix": "Keep the default limit (100) for any input you do not control",
       "why": "The limit is what stops alias-expansion files from exhausting memory."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Can I use it in a paid, closed-source app?",
       "a": "Yes. The ISC license allows any use with or without a fee; keep the copyright and license notice.",
       "evidence": {
        "url": "https://github.com/eemeli/yaml/blob/v2.9.1/LICENSE",
        "quote": "Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies."
       }
      },
      {
       "q": "Does it keep comments when I save a file?",
       "a": "Yes, if you edit through parseDocument and save with toString(); the quick parse and stringify functions give plain data without comments.",
       "evidence": {
        "url": "https://eemeli.org/yaml/",
        "quote": "In order to work with YAML features not directly supported by native JavaScript data types, such as comments, anchors and aliases, yaml provides the Document API."
       }
      },
      {
       "q": "Why does NO (Norway) or yes stay text?",
       "a": "By default yaml reads files by the YAML 1.2 rules, where only true and false are true or false. Pass version '1.1' to read files written for older tools.",
       "evidence": {
        "url": "https://eemeli.org/yaml/",
        "quote": "and their negative counterparts are parsed as strings."
       }
      },
      {
       "q": "Does it run in the browser?",
       "a": "Yes. It has no other packages it depends on and runs in Node.js and in modern browsers.",
       "evidence": {
        "url": "https://github.com/eemeli/yaml/blob/v2.9.1/README.md",
        "quote": "It has no external dependencies and runs on Node.js as well as modern browsers."
       }
      },
      {
       "q": "Is it maintained?",
       "a": "Yes. Version 2.9.1 was published on 11 September 2026, and a version 3 is in prerelease.",
       "evidence": {
        "url": "https://registry.npmjs.org/yaml",
        "quote": "\"2.9.1\":\"2026-09-11T20:30:10.905Z\""
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm yaml"
  ],
  [
   "Category",
   "Utilities"
  ],
  [
   "License",
   "ISC"
  ],
  [
   "Latest version",
   "v2.9.1, September 11, 2026"
  ],
  [
   "On GitHub since",
   "January 2018"
  ],
  [
   "Gid Score",
   "70.0"
  ],
  [
   "Rank in category",
   "#5 of 408"
  ],
  [
   "GitHub",
   "eemeli/yaml"
  ],
  [
   "Last change",
   "Sep 23, 2026"
  ]
 ],
 "good": [
  "The quick parse function stops with an error on a broken file, so your app should catch it and show the message.",
  "The quick parse function reads one document per file; files with several parts split by --- need parseAllDocuments.",
  "By default it follows the newer YAML 1.2 rules, where only true and false mean yes or no; words like yes, no and on stay text."
 ],
 "checked_line": "Read by AgentGid from 6 official pages, card checked Nov 10, 2026; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/eemeli.png"
}