# json-nested-replace

> Searches and replace values at every level of nested json

Latest version **1.1.0** (published 2023-04-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install json-nested-replace
pnpm add json-nested-replace
yarn add json-nested-replace
bun add json-nested-replace
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2023-04-16 |
| First published | 2019-01-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Arshad Kazmi |
| Maintainers | arshadkazmi42 |
| Keywords | search, replace, json-replace, json, find-and-replace |

## Links

- npm: https://www.npmjs.com/package/json-nested-replace
- Repository: https://github.com/arshadkazmi42/json-nested-replace
- Homepage: https://github.com/arshadkazmi42/json-nested-replace#readme
- Issues: https://github.com/arshadkazmi42/json-nested-replace/issues
- npm.io page: https://npm.io/package/json-nested-replace

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.1.0 (latest) — 2023-04-16
- 1.0.4 — 2021-08-15
- 1.0.3 — 2019-08-17
- 1.0.2 — 2019-02-06
- 1.0.1 — 2019-01-29
- 1.0.0 — 2019-01-29

## README

# json-nested-replace

[![Build](https://github.com/arshadkazmi42/json-nested-replace/actions/workflows/nodejs.yml/badge.svg)](https://github.com/arshadkazmi42/json-nested-replace/actions/workflows/nodejs.yml)
[![NPM Version](https://img.shields.io/npm/v/json-nested-replace.svg)](https://www.npmjs.com/package/json-nested-replace)
[![NPM Downloads](https://img.shields.io/npm/dt/json-nested-replace.svg)](https://www.npmjs.com/package/json-nested-replace)
[![Github Repo Size](https://img.shields.io/github/repo-size/arshadkazmi42/json-nested-replace.svg)](https://github.com/arshadkazmi42/json-nested-replace)
[![LICENSE](https://img.shields.io/npm/l/json-nested-replace.svg)](https://github.com/arshadkazmi42/json-nested-replace/blob/master/LICENSE)
[![Contributors](https://img.shields.io/github/contributors/arshadkazmi42/json-nested-replace.svg)](https://github.com/arshadkazmi42/json-nested-replace/graphs/contributors)
[![Commit](https://img.shields.io/github/last-commit/arshadkazmi42/json-nested-replace.svg)](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:

<a href="https://github.com/arshadkazmi42"><img src="https://github.com/arshadkazmi42.png" width="30" /></a><a href="https://github.com/ayanujju"><img src="https://github.com/ayanujju.png" width="30" /></a>

---
_Source: https://npm.io/package/json-nested-replace · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
