{"id":15663638,"url":"https://github.com/doowb/stringify-keys","last_synced_at":"2025-09-10T08:39:11.212Z","repository":{"id":24937321,"uuid":"28354674","full_name":"doowb/stringify-keys","owner":"doowb","description":"Build an array of key paths from an object.","archived":false,"fork":false,"pushed_at":"2019-01-22T05:32:45.000Z","size":31,"stargazers_count":17,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-19T12:13:52.722Z","etag":null,"topics":["dot-notation","expand","javascript","key","key-paths","keys","object","objects","paths","stringify"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doowb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-22T19:16:34.000Z","updated_at":"2024-07-23T02:09:19.000Z","dependencies_parsed_at":"2022-09-16T11:52:47.190Z","dependency_job_id":null,"html_url":"https://github.com/doowb/stringify-keys","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fstringify-keys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fstringify-keys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fstringify-keys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fstringify-keys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doowb","download_url":"https://codeload.github.com/doowb/stringify-keys/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252591057,"owners_count":21773017,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dot-notation","expand","javascript","key","key-paths","keys","object","objects","paths","stringify"],"created_at":"2024-10-03T13:39:03.041Z","updated_at":"2025-05-05T23:22:01.545Z","avatar_url":"https://github.com/doowb.png","language":"JavaScript","readme":"# stringify-keys [![NPM version](https://img.shields.io/npm/v/stringify-keys.svg?style=flat)](https://www.npmjs.com/package/stringify-keys) [![NPM monthly downloads](https://img.shields.io/npm/dm/stringify-keys.svg?style=flat)](https://npmjs.org/package/stringify-keys) [![NPM total downloads](https://img.shields.io/npm/dt/stringify-keys.svg?style=flat)](https://npmjs.org/package/stringify-keys) [![Linux Build Status](https://img.shields.io/travis/doowb/stringify-keys.svg?style=flat\u0026label=Travis)](https://travis-ci.org/doowb/stringify-keys)\n\n\u003e Build an array of key paths from an object.\n\nPlease consider following this project's author, [Brian Woodward](https://github.com/doowb), and consider starring the project to show your :heart: and support.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save stringify-keys\n```\n\nSee the [Release History](#release-history) for changes.\n\n## Usage\n\n```js\nconst stringify = require('stringify-keys');\n\nlet obj = { a: 'a', b: { c: { d: { e: 'f' } } } };\nconsole.log(stringify(obj));\n//=\u003e [ 'a', 'b.c.d.e' ]\n```\n\nInclude values in the result:\n\n```js\nconsole.log(stringify(obj, { values: true }));\n//=\u003e { a: 'a', 'b.c.d.e': 'f' }\n```\n\nKeys with dots are automatically escaped with backslashes (this can be [customized](#optionsescape)):\n\n```js\nlet obj = { 'a.b.c': { d: 'e' } };\nconsole.log(stringify(obj));\n//=\u003e [ 'a\\\\.b\\\\.c.d' ]\n\nconsole.log(stringify(obj, { values: true }));\n//=\u003e { 'a\\\\.b\\\\.c.d': 'e' }\n```\n\nObjects with arrays return the array indices as part of the paths:\n\n```js\nlet obj = { a: 'a', b: [{ c: { d: 'e' } }, { f: { g: 'h' } }] };\n\nconsole.log(stringify(obj));\n//=\u003e [ 'a', 'b.0.c.d', 'b.1.f.g' ]\n\nconsole.log(stringify(obj, { values: true }));\n//=\u003e { a: 'a', 'b.0.c.d': 'e', 'b.1.f.g': 'h' }\n```\n\n## Options\n\n### options.separator\n\n**Type**: `string`\n\n**Default**: `.`\n\nCustom separator to use for creating object paths (`a.b.c`):\n\n**Example**\n\n```js\nlet obj = { 'a.b.c': { d: 'e' } };\nconsole.log(stringify(obj, { separator: '/' }));\n//=\u003e  [ 'a.b.c/d' ]\n\nconsole.log(stringify(obj, { separator: '/', values: true }));\n//=\u003e  { 'a.b.c/d': 'e' }\n```\n\n### options.escape\n\n**Type**: `function`\n\n**Default**: adds `\\\\` before dots\n\nCustom function to use for escaping keys.\n\n**Example**\n\n```js\nlet obj = { 'a.b.c': { d: 'e' } };\nlet escape = str =\u003e str.split('.').join('/');\n\nconsole.log(stringify(obj, { escape }));\n//=\u003e  [ 'a/b/c.d' ]\n\nconsole.log(stringify(obj, { escape, values: true }));\n//=\u003e  { 'a/b/c.d': 'e' }\n```\n\n## Release History\n\n### v3.0\n\n* Redundant (parent) keys are no longer included in the output. Thus `{ a: { b: 'c' } }` now returns `['a.b']` instead of `['a', 'a.b']`.\n\n### v2.0\n\n* Added support for traversing into arrays.\n\n## About\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eContributing\u003c/strong\u003e\u003c/summary\u003e\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eRunning Tests\u003c/strong\u003e\u003c/summary\u003e\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eBuilding docs\u003c/strong\u003e\u003c/summary\u003e\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n\u003c/details\u003e\n\n### Related projects\n\nYou might also be interested in these projects:\n\n* [expand-hash](https://www.npmjs.com/package/expand-hash): Recursively expands property keys with dot-notation into objects. | [homepage](https://github.com/doowb/expand-hash \"Recursively expands property keys with dot-notation into objects.\")\n* [expand-object](https://www.npmjs.com/package/expand-object): Expand a string into a JavaScript object using a simple notation. Use the CLI or… [more](https://github.com/jonschlinkert/expand-object) | [homepage](https://github.com/jonschlinkert/expand-object \"Expand a string into a JavaScript object using a simple notation. Use the CLI or as a node.js lib.\")\n* [glob-object](https://www.npmjs.com/package/glob-object): Filter an object using glob patterns and dot notation. | [homepage](https://github.com/jonschlinkert/glob-object \"Filter an object using glob patterns and dot notation.\")\n* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of \"Get the native type of a value.\")\n\n### Contributors\n\n| **Commits** | **Contributor** |  \n| --- | --- |  \n| 19 | [doowb](https://github.com/doowb) |  \n| 17 | [jonschlinkert](https://github.com/jonschlinkert) |  \n| 1  | [contra](https://github.com/contra) |  \n\n### Author\n\n**Brian Woodward**\n\n* [GitHub Profile](https://github.com/doowb)\n* [Twitter Profile](https://twitter.com/doowb)\n* [LinkedIn Profile](https://linkedin.com/in/woodwardbrian)\n\n### License\n\nCopyright © 2019, [Brian Woodward](https://github.com/doowb).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on January 22, 2019._","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fstringify-keys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoowb%2Fstringify-keys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fstringify-keys/lists"}