{"id":13659778,"url":"https://github.com/hlefebvr/json-manipulation","last_synced_at":"2025-04-24T15:30:54.237Z","repository":{"id":57285043,"uuid":"106568092","full_name":"hlefebvr/json-manipulation","owner":"hlefebvr","description":"Small module which enables to manipulate json structures.","archived":false,"fork":false,"pushed_at":"2018-08-08T12:48:57.000Z","size":17,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T18:51:06.331Z","etag":null,"topics":["json","json-manipulation","omit"],"latest_commit_sha":null,"homepage":"","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/hlefebvr.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":"2017-10-11T14:51:55.000Z","updated_at":"2023-08-30T20:25:52.000Z","dependencies_parsed_at":"2022-09-07T12:12:06.895Z","dependency_job_id":null,"html_url":"https://github.com/hlefebvr/json-manipulation","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlefebvr%2Fjson-manipulation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlefebvr%2Fjson-manipulation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlefebvr%2Fjson-manipulation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlefebvr%2Fjson-manipulation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hlefebvr","download_url":"https://codeload.github.com/hlefebvr/json-manipulation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250654162,"owners_count":21465827,"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":["json","json-manipulation","omit"],"created_at":"2024-08-02T05:01:12.216Z","updated_at":"2025-04-24T15:30:53.925Z","avatar_url":"https://github.com/hlefebvr.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# json-omit : JSON manipulation node module\n\n![version](https://img.shields.io/npm/v/json-omit.svg)\n![npm downloads](https://img.shields.io/npm/dm/json-omit.svg)\n![licence](https://img.shields.io/github/license/hlefebvr/json-manipulation.svg)\n![maintained](https://img.shields.io/badge/Maintained_%3F-yes-green.svg)\n![open issues](https://img.shields.io/github/issues-raw/hlefebvr/json-manipulation.svg)\n![open issues](https://img.shields.io/github/issues-closed/hlefebvr/json-manipulation.svg)\n\nInstall : `npm install --save json-omit`\n\nAvailable functions :\n\n- `omit(originialObject, ...paths)` : copies the `originalObject` and deletes attributes specified in `...paths` before returning the result\n- `clone(originalObject)` : retruns a **deep** copy of the `originalObject`\n\n## Examples\n\n```javascript\nconst { omit, clone } = require(\"json-omit\");\n```\n\n### omit(originalObject, ...paths)\n\nomit attributes or nested attributes :\n\n```javascript\nconst orignialObject = {\n  depth0: {\n    depth1: {\n      attr1: \"keep this attribute\",\n      attr2: { value: \"remove me\" },\n      attr3: \"remove me as well\"\n    }\n  },\n  someOtherAttribute: \"I should be removed\"\n};\n\nconst omitted = omit(\n  originalObject,\n  \"depth0.depth1.attr2\",\n  \"depth0.depth1.attr3\",\n  \"someOtherAttribute\"\n);\n\nconsole.log(omitted);\n/*\n{\n  depth0: {\n    depth1: {\n      attr1: \"keep this attribute\"\n    }\n  }\n}\n*/\n```\n\nomit attribute or nested attribute in every row of array\n\n```javascript\nconst originalObject = {\n  history: [\n    { timestamp: \"1234567\", value: \"example1\" },\n    { timestamp: \"1234568\", value: \"example1\", extraValue: true },\n    { timestamp: \"1234569\", value: \"example1\" },\n    { timestamp: \"1234570\", value: \"example1\" }\n  ]\n};\n\nconst omitted = omit(originalObject, \"history.value\");\n\nconsole.log(omitted);\n/*\n{\n  history: [\n    { timestamp: \"1234567\" },\n    { timestamp: \"1234568\" },\n    { timestamp: \"1234569\" },\n    { timestamp: \"1234570\" }\n  ]\n}\n*/\n```\n\nomit attribute or nested attribute in specific row of array\n\n```javascript\nconst originalObject = {\n  history: [\n    { timestamp: \"1234567\", value: \"example1\" },\n    { timestamp: \"1234568\", value: \"example1\" },\n    { timestamp: \"1234569\", value: \"example1\" },\n    { timestamp: \"1234570\", value: \"example1\" }\n  ]\n};\n\nconst omitted = omit(originalObject, \"history.2.value\");\n\nconsole.log(omitted);\n/*\n{\n  history: [\n    { timestamp: \"1234567\", value: \"example1\" },\n    { timestamp: \"1234568\", value: \"example1\" },\n    { timestamp: \"1234569\" },\n    { timestamp: \"1234570\", value: \"example1\" }\n  ]\n};\n*/\n```\n\n### clone(originalObject)\n\n```javascript\nconst originalObject = {\n  depth0: { depth1: { depth2: { value: \"nested value\" } } }\n};\nconst copiedObject = clone(originalObject);\n\ncopiedObject.depth0.depth1.depth2.value = \"changed nested value\";\n\nconsole.log(originalObject.depth0.depth1.depth2.value); // outputs \"nested value\"\nconsole.log(copiedObject.depth0.depth1.depth2.value); // outputs \"changed nested value\"\n```\n\n## Contributing\n\n- Contributing is **very welcomed** via pull requests or creating issues\n- If you make a pull request, be sure to write/adapt a test file with respect to your specific changes\n- Running tests is done via mocha and npm, run them like so : `npm t`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhlefebvr%2Fjson-manipulation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhlefebvr%2Fjson-manipulation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhlefebvr%2Fjson-manipulation/lists"}