# json-object-into-array-merger

> Updates JSON array with JSON object.

Latest version **0.0.3** (published 2018-08-23) · GPLv3 license · 0 weekly downloads

## Install

```sh
npm install json-object-into-array-merger
pnpm add json-object-into-array-merger
yarn add json-object-into-array-merger
bun add json-object-into-array-merger
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2018-08-23 |
| First published | 2018-08-23 |
| Weekly downloads | 0 |
| License | GPLv3 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 15 |
| Unpacked size | 16.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Laurent Dellere |
| Maintainers | laurentd |

## Links

- npm: https://www.npmjs.com/package/json-object-into-array-merger
- Repository: https://gitlab.com/lorenzo-de/json-merger
- Homepage: https://gitlab.com/lorenzo-de/json-merger#README
- Issues: https://gitlab.com/lorenzo-de/json-merger/issues
- npm.io page: https://npm.io/package/json-object-into-array-merger

## Dependencies (15)

- [ramda](https://npm.io/package/ramda.md) 0.25.0
- [rimraf](https://npm.io/package/rimraf.md) 2.6.2
- [is-uuid](https://npm.io/package/is-uuid.md) 1.0.2
- [bluebird](https://npm.io/package/bluebird.md) 3.5.1
- [babel-cli](https://npm.io/package/babel-cli.md) 6.26.0
- [sanctuary](https://npm.io/package/sanctuary.md) 0.15.0
- [babel-core](https://npm.io/package/babel-core.md) 6.26.0
- [babel-eslint](https://npm.io/package/babel-eslint.md) ^8.0.2
- [babel-loader](https://npm.io/package/babel-loader.md) 7.1.2
- [make-runnable](https://npm.io/package/make-runnable.md) 1.3.6
- [babel-preset-env](https://npm.io/package/babel-preset-env.md) 1.6.1
- [babel-preset-es2015](https://npm.io/package/babel-preset-es2015.md) 6.24.1
- [babel-preset-stage-0](https://npm.io/package/babel-preset-stage-0.md) 6.24.1
- [babel-plugin-transform-runtime](https://npm.io/package/babel-plugin-transform-runtime.md) 6.23.0
- [babel-plugin-transform-class-properties](https://npm.io/package/babel-plugin-transform-class-properties.md) 6.24.1

## Recent versions

- 0.0.3 (latest) — 2018-08-23
- 0.0.2 — 2018-08-23
- 0.0.1 — 2018-08-23

## README

## Description

Updates JSON array in one file with JSON object from another file.

### Example

Say you have the following JSON array in file ```data.json```:

```[{title: "first", uuid: 24e22aa8-a069-11e8-98d0-529269fb1459},{title: "second", uuid: 24e22ec2-a069-11e8-98d0-529269fb1459},{title: "third", uuid: 24e23160-a069-11e8-98d0-529269fb1459}]```

If you modified one of the objects, f.e. ```{title: "Formerly known as first", uuid: 24e22aa8-a069-11e8-98d0-529269fb1459}``` in another file ```partial-data.json```, then you can update ```data.json``` with this script so that ```data.json``` will become:


```[{title: "Formerly known as first", uuid: 24e22aa8-a069-11e8-98d0-529269fb1459},{title: "second", uuid: 24e22ec2-a069-11e8-98d0-529269fb1459},{title: "third", uuid: 24e23160-a069-11e8-98d0-529269fb1459}]```

### CLI usage

```npm run merge --sourcePath=/path/to/mergethis.json --targetPath=/path/to/mergeintothis.json --outputPath=/path/to/output.json --uuidKey=uuid```


### Usage in module

```
var merger = require('json-object-into-array-merger')

var conf = {
  sourcePath: '/path/to/mergethis.json',
  targetPath: '/path/to/mergeintothis.json',
  outputPath: '/path/to/output.json',
  uuidKey: 'uuid'
}

merger.mergeJSON(conf)
```

### Configuration options

```sourcePath```: String: path to JSON file with object to be merged

```outputPath```: String: path to file where output is saved

```targetPath```: String: path to JSON file into which object from sourcePath is merged

```uuidKey```: String: uuid key


### Tests

Run unit tests:

```npm run test```

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