{"id":29362913,"url":"https://github.com/patternhelloworld/json-knife","last_synced_at":"2025-07-09T09:17:27.937Z","repository":{"id":36949218,"uuid":"233390410","full_name":"patternhelloworld/json-knife","owner":"patternhelloworld","description":"A Regex Engine to Parse and Apply Bulk Changes to a JSON String Without Using 'JSON.parse()' for Deserialization","archived":false,"fork":false,"pushed_at":"2022-12-11T20:13:17.000Z","size":1265,"stargazers_count":28,"open_issues_count":15,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-25T06:08:32.179Z","etag":null,"topics":["javascript","json","json-parser","json-parsing","json-schema","json-update","nested-set","parse","parser","serialization"],"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/patternhelloworld.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":"2020-01-12T12:39:41.000Z","updated_at":"2025-02-23T08:45:21.000Z","dependencies_parsed_at":"2023-01-17T07:25:51.005Z","dependency_job_id":null,"html_url":"https://github.com/patternhelloworld/json-knife","commit_stats":null,"previous_names":["patternknife/json-knife","andrew-kang-g/json-knife","patternhelloworld/json-knife"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/patternhelloworld/json-knife","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patternhelloworld%2Fjson-knife","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patternhelloworld%2Fjson-knife/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patternhelloworld%2Fjson-knife/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patternhelloworld%2Fjson-knife/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patternhelloworld","download_url":"https://codeload.github.com/patternhelloworld/json-knife/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patternhelloworld%2Fjson-knife/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264428786,"owners_count":23606692,"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":["javascript","json","json-parser","json-parsing","json-schema","json-update","nested-set","parse","parser","serialization"],"created_at":"2025-07-09T09:17:25.410Z","updated_at":"2025-07-09T09:17:27.928Z","avatar_url":"https://github.com/patternhelloworld.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json-knife [![Build Status](https://travis-ci.org/Andrew-Kang-G/json-knife.svg?branch=master)](https://travis-ci.org/Andrew-Kang-G/json-knife) [![NPM version](https://img.shields.io/npm/v/json-knife.svg)](https://www.npmjs.com/package/json-knife) [![](https://data.jsdelivr.com/v1/package/gh/Andrew-Kang-G/json-knife/badge)](https://www.jsdelivr.com/package/gh/Andrew-Kang-G/json-knife)\n## Overview\nMass replace specific properties value with a new value recursively in huge, complex and deep JSON string \nwith a robust regular expression based engine.\n\nZero dependency, 7KB\n\n\u003ca href=\"http://jsfiddle.net/AndrewKang/mq7v54h3/\" target=\"_blank\"\u003eLIVE DEMO\u003c/a\u003e\n\n\n## Installation\n\nFor ES5 users,\n\n``` html\n\u003chtml\u003e\n       \u003cbody\u003e\n       \t\u003cscript src=\"../dist/json-knife.bundle.js\"\u003e\u003c/script\u003e\n       \t\u003cscript type=\"text/javascript\"\u003e\n         \n       \t\u003c/script\u003e\n       \u003c/body\u003e\n\u003c/html\u003e\n```\n\nFor ES6 npm users, run 'npm install --save json-knife' on console.\n\n``` html\nimport Pattern from 'json-knife';\n```\n\n## Syntax \u0026 Usage\nVery simple to use. Now we are going to set all 'Mike{[Gentleman]}' to null in the sample JSON string.\n\n```javascript\n\n    /**\n     * @brief\n     * Mass Update certain key-values recursively in huge, complex JSON string trees\n     * @author Andrew Kang\n     * @param original string required (must be JSON string)\n     * @param key string required\n     * @param value string or boolean or number or null required\n     * @return string\n     */\n    \n      // IMPORTANT : the variable 'original' should be valid JSON.\n      // You can test your JSON string source like here. \n      // https://jsonformatter.curiousconcept.com/\n    \n    var result = Pattern.sculptJson(original, 'Mike{[Gentleman]}', null);\n    \n    // You can convert the result string to an object type.\n    var resultObj = JSON.parse(result);\n    \n```\n**[Original source]**\n\nvar original =\n```json\n{\n        \"prob\\\"lems\": [{\n            \"classes\": [{\n                \"medications\": [{\n                    \"medicationsClasses\": [{\n                        \"Mike {[Gentleman]}\": [{\n                            \"associatedDrug\": [{\n                                \"name\": \"asprin\",\n                                \"dose\": 35.3,\n                                \"strength\": \"500 mg\",\n                                \"className\" : false\n                            }],\n                            \"Mike {[Gentleman]}\": [{\n                                \"name\": \"somethingElse\",\n                                \"dose\": \"\",\n                                \"strength\": \"500 mg\",\n                                \"friends\": {\n                                    \"self\": {\n                                        \"Mike {[Gentleman]}\": \"33\",\n                                        \"names\": [\"aa\"]\n                                    }\n                                }\n                            }]\n                        }],\n                        \"Judy\": [{\n                            \"associatedDrug\": [{\n                                \"name\": \"asprin\",\n                                \"dose\": \"\",\n                                \"strength\": \"500 mg\",\n                                \"friends\": [\"Mike {[Gentleman]}\"]\n                            }],\n                            \"associatedDrug#2\": [{\n                                \"name\": \"somethingElse\",\n                                \"dose\": \"\",\n                                \"strength\": \"500 mg\"\n                            }],\n                            \"friends\": [{\"Mike {[Gentleman]}\": null}, {\"Mike {[Gentleman]}\": [[\"c[ 3\\\"5ool\", 35], [\"ca],[1\\\"3lm\"], 53]}, \"Jackson\", \"Mike {[Gentleman]}\"]\n                        }]\n                    }]\n                }],\n                \"classNameMissed\": [{\n                    \"Mike {[Gentleman]}\": \"missing_value\"\n                }]\n            }],\n            \"className\": [{}]\n        }]\n    }\n```\n**[Result]** - string type\n\n```json\n{\n        \"prob\\\"lems\": [{\n            \"classes\": [{\n                \"medications\": [{\n                    \"medicationsClasses\": [{\n                        \"Mike {[Gentleman]}\": null,\n                        \"Judy\": [{\n                            \"associatedDrug\": [{\n                                \"name\": \"asprin\",\n                                \"dose\": \"\",\n                                \"strength\": \"500 mg\",\n                                \"friends\": [\"Mike {[Gentleman]}\"]\n                            }],\n                            \"associatedDrug#2\": [{\n                                \"name\": \"somethingElse\",\n                                \"dose\": \"\",\n                                \"strength\": \"500 mg\"\n                            }],\n                            \"friends\": [{\"Mike {[Gentleman]}\": null}, {\"Mike {[Gentleman]}\": null}, \"Jackson\", \"Mike {[Gentleman]}\"]\n                        }]\n                    }]\n                }],\n                \"classNameMissed\": [{\n                    \"Mike {[Gentleman]}\": null\n                }]\n            }],\n            \"className\": [{}]\n        }]\n    }\n```\n\nPlease inform me of the source related things by leaving issues on Github or emailing me at studypurpose@naver.com.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatternhelloworld%2Fjson-knife","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatternhelloworld%2Fjson-knife","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatternhelloworld%2Fjson-knife/lists"}