1.1.2 • Published 5 years ago
mergejson v1.1.2
Recursively merge json documents in a new one.
Node.js Usage
npm install mergejson --save
var mergejson = require('mergejson')
var dominant = {
'1':'hello',
'3':{
'3.1': 'jhon',
'3.2': 'doe'
}
}
var recessive = {
'2': 'world',
'3':{
'3.1': 'jhon',
'3.2': 'lennon'
}
}
console.log(mergejson(dominant, recessive));
// -> {'1': 'hello', '2': 'world', '3': {'3.1': 'jhon', '3.2': 'doe'}}
var one = {
'1':'hello',
'4':{
'4.1': 'jhon',
'4.2': 'doe'
}
}
var two = {
'2': 'world',
'4':{
'4.1': 'jhon',
'4.2': 'lennon',
'4.3': 'from two'
}
}
var three = {
'3': '!',
'4':{
'4.1': 'jhon',
'4.2': 'lennon',
'4.3': 'from three'
}
}
console.log(mergejson(one, two, three));
// -> {'1': 'hello', '2': 'world', '3': '!', '4': {'4.1': 'jhon', '4.2': 'doe', '4.3': 'from two'}}
console.log(mergejson([one, two, three]));
// -> {'1': 'hello', '2': 'world', '3': '!', '4': {'4.1': 'jhon', '4.2': 'doe', '4.3': 'from two'}}
Terminal Usage
npm install -g mergejson
mergejson {\"1\":\"one\"} {\"2\":\"two\"} {\"3\":\"three\"}
# ->
#
# {
# '1': 'one',
# '2': 'two',
# '3': 'three'
# }
mergejson $(cat one.json) $(cat two.json) $(cat three.json)
# ->
#
# {
# '1': 'one',
# '2': 'two',
# '3': 'three'
# }
1.1.2
5 years ago
1.1.1
5 years ago
1.1.0
7 years ago
1.0.32
7 years ago
1.0.31
7 years ago
1.0.30
7 years ago
1.0.29
8 years ago
1.0.28
8 years ago
1.0.27
8 years ago
1.0.26
8 years ago
1.0.25
9 years ago
1.0.24
9 years ago
1.0.23
9 years ago
1.0.22
9 years ago
1.0.21
9 years ago
1.0.20
9 years ago
1.0.19
9 years ago
1.0.18
9 years ago
1.0.17
9 years ago
1.0.16
9 years ago
1.0.15
9 years ago
1.0.14
9 years ago
1.0.13
9 years ago
1.0.12
9 years ago
1.0.11
9 years ago
1.0.10
9 years ago
1.0.9
9 years ago
1.0.8
9 years ago
1.0.7
9 years ago
1.0.6
9 years ago
1.0.5
9 years ago
1.0.3
9 years ago
1.0.2
9 years ago