{"id":18829,"library":"stringify-keys","title":"stringify-keys","description":"Build an array of key paths from a nested object, with support for custom separators, escaping, and optional inclusion of values. Version 3.0.0 removes redundant parent keys (e.g., 'a' is omitted when 'a.b' exists) and adds array traversal support. Maintenance-mode library with low release cadence (last major update in 2018). Differentiated by lightweight size, simple API, and escape handling for keys containing dots.","status":"maintenance","version":"3.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/doowb/stringify-keys","tags":["javascript","dot","keys","nested","notation","object","path","paths","recurse"],"install":[{"cmd":"npm install stringify-keys","lang":"bash","label":"npm"},{"cmd":"yarn add stringify-keys","lang":"bash","label":"yarn"},{"cmd":"pnpm add stringify-keys","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default import is the function. CJS require also works but ESM is preferred.","wrong":"const stringify = require('stringify-keys')","symbol":"default (stringify)","correct":"import stringify from 'stringify-keys'"},{"note":"TypeScript users can import Options interface for type safety. Not exported as a value.","wrong":null,"symbol":"type definitions","correct":"import type { Options } from 'stringify-keys'"},{"note":"The module exports a single function, not an object with a named export.","wrong":"const { stringify } = require('stringify-keys')","symbol":"CommonJS require","correct":"const stringify = require('stringify-keys')"}],"quickstart":{"code":"import stringify from 'stringify-keys';\n\nconst obj = {\n  a: 'a',\n  b: {\n    c: {\n      d: { e: 'f' }\n    }\n  },\n  'a.b.c': { d: 'e' },\n  arr: [{ x: 1 }, { y: 2 }]\n};\n\n// Basic usage: get key paths as array\nconsole.log(stringify(obj));\n// Output: ['a', 'b.c.d.e', 'a\\\\.b\\\\.c.d', 'arr.0.x', 'arr.1.y']\n\n// Include values in result object\nconsole.log(stringify(obj, { values: true }));\n// Output: { a: 'a', 'b.c.d.e': 'f', 'a\\\\.b\\\\.c.d': 'e', 'arr.0.x': 1, 'arr.1.y': 2 }\n\n// Custom separator\nconsole.log(stringify(obj, { separator: '/' }));\n// Output: ['a', 'b/c/d/e', 'a.b.c/d', 'arr/0/x', 'arr/1/y']\n\n// Custom escape function\nconst escapeFn = (str) => str.split('.').join('_');\nconsole.log(stringify({ 'a.b': 'c' }, { escape: escapeFn }));\n// Output: ['a_b']","lang":"typescript","description":"Demonstrates basic usage, values output, custom separator, and custom escape function."},"warnings":[{"fix":"Update any code that expects parent keys to be present. Use { values: true } with paths including parents if needed.","message":"In v3.0.0, redundant parent keys are no longer included. For example, stringify({a: {b: 'c'}}) returns ['a.b'] instead of ['a', 'a.b'].","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use the escape option or manually handle backslash-escaping when processing paths.","message":"Keys containing dots are automatically escaped with backslashes by default (e.g., 'a.b' becomes 'a\\\\.b'). This can break naive string splitting.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Filter out array indices from results if needed, or avoid passing arrays directly.","message":"Array indices are included as numeric path parts (e.g., 'arr.0.x'). This may not be expected if you want to skip array traversal.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Consider migrating to alternatives like dot-prop or object-path if active development is needed.","message":"The package is in maintenance mode with no recent updates. It may not receive fixes for future Node.js versions.","severity":"deprecated","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use 'import stringify from 'stringify-keys'' or 'const stringify = require('stringify-keys')'.","cause":"Wrong import: using destructured import { stringify } instead of default import.","error":"TypeError: stringify is not a function"},{"fix":"Run 'npm install stringify-keys' and ensure the import path is exactly 'stringify-keys'.","cause":"Package not installed or typo in package name.","error":"Cannot find module 'stringify-keys'"},{"fix":"Parse the JSON string first: 'stringify(JSON.parse(str))'.","cause":"Passing a JSON string instead of a JavaScript object.","error":"Unexpected token in JSON at position X"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}