Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ravenox/go-jsonmerge
Merge JSON objects to one (replaces only existent values)
https://github.com/ravenox/go-jsonmerge
golang json merge
Last synced: 6 days ago
JSON representation
Merge JSON objects to one (replaces only existent values)
- Host: GitHub
- URL: https://github.com/ravenox/go-jsonmerge
- Owner: RaveNoX
- License: mit
- Created: 2016-10-03T17:59:57.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-13T19:29:14.000Z (over 4 years ago)
- Last Synced: 2024-10-29T20:25:02.656Z (9 days ago)
- Topics: golang, json, merge
- Language: Go
- Size: 43.9 KB
- Stars: 31
- Watchers: 4
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-jsonmerge
[![Build Status](https://travis-ci.org/RaveNoX/go-jsonmerge.svg?branch=master)](https://travis-ci.org/RaveNoX/go-jsonmerge)
[![GoDoc](https://godoc.org/github.com/RaveNoX/go-jsonmerge?status.svg)](https://godoc.org/github.com/RaveNoX/go-jsonmerge)GO library for merging JSON objects
## Original document
```json
{
"number": 1,
"string": "value",
"object": {
"number": 1,
"string": "value",
"nested object": {
"number": 2
},
"array": [1, 2, 3],
"partial_array": [1, 2, 3]
}
}
```## Patch
```json
{
"number": 2,
"string": "value1",
"nonexitent": "woot",
"object": {
"number": 3,
"string": "value2",
"nested object": {
"number": 4
},
"array": [3, 2, 1],
"partial_array": {
"1": 4
}
}
}
```## Result
```json
{
"number": 2,
"string": "value1",
"object": {
"number": 3,
"string": "value2",
"nested object": {
"number": 4
},
"array": [3, 2, 1],
"partial_array": [1, 4, 3]
}
}
```## Commandline Tool
```bash
$ go get -u github.com/RaveNoX/go-jsonmerge/cmd/jsonmerge
$ jsonmerge [options] ...
# For help
$ jsonmerge -h
```## Development
```
# Install depencencies
./init.sh# Build
./build.sh
```## License
[MIT](./LICENSE.MD)