https://github.com/arshadkazmi42/json-nested-replace
Searches and replace values at every level of nested json
https://github.com/arshadkazmi42/json-nested-replace
json json-nested-replace json-replace json-search json-update search
Last synced: 2 months ago
JSON representation
Searches and replace values at every level of nested json
- Host: GitHub
- URL: https://github.com/arshadkazmi42/json-nested-replace
- Owner: arshadkazmi42
- License: mit
- Created: 2019-01-29T16:20:45.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-04-16T23:14:45.000Z (about 2 years ago)
- Last Synced: 2025-03-17T16:21:11.629Z (2 months ago)
- Topics: json, json-nested-replace, json-replace, json-search, json-update, search
- Language: JavaScript
- Size: 147 KB
- Stars: 4
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# json-nested-replace
[](https://github.com/arshadkazmi42/json-nested-replace/actions/workflows/nodejs.yml)
[](https://www.npmjs.com/package/json-nested-replace)
[](https://www.npmjs.com/package/json-nested-replace)
[](https://github.com/arshadkazmi42/json-nested-replace)
[](https://github.com/arshadkazmi42/json-nested-replace/blob/master/LICENSE)
[](https://github.com/arshadkazmi42/json-nested-replace/graphs/contributors)
[](https://github.com/arshadkazmi42/json-nested-replace/commits/master)Searches and replace values at every level of nested json
> Give us a :star: if you like our work :heart:
## Install
```
$ npm install json-nested-replace
```## Usage
```javascript
const jnestedReplace = require('json-nested-replace');const INPUT_JSON = {
'name': 'json-nested-replace',
'author': 'Arshad Kazmi',
'repository': {
'url': 'https://github.com/arshadkazmi42/json-nested-replace',
'language': 'js'
}
};const replacedJSONValue = jnestedReplace(INPUT_JSON, 'json-nested-replace', 'jnested-replace', ['url']);
console.log(replacedJSONValue);
// Output
/** {
* 'name': 'jnested-replace',
* 'author': 'Arshad Kazmi',
* 'repository': {
* 'url': 'https://github.com/arshadkazmi42/json-nested-replace',
* 'language': 'js'
* }
* }
**/```
## Function Parameters
Function `jnestedReplace` takes following parameters respectively
- `input`: Object/Array on which nested replace to apply
- `searchValue`: Value which needs to be replaced in the JSON
- `newValue`: New Value which needs to be added in place of searchValue
- `skipKeys`: Optinal field, if any key needs to be skipped from this replacing## Contributing
Interested in contributing to this project?
You can log any issues or suggestion related to this library [here](https://github.com/arshadkazmi42/json-nested-replace/issues/new)Read our contributing [guide](CONTRIBUTING.md) on getting started with contributing to the codebase
## Contributors
Thank you to all the contributors who have helped us in making this project better :raised_hands: