How to merge array of objects A and B and form array of object C contains new key value pair?
up vote
0
down vote
favorite
I am using Node.js for programming,
In the below array of Objects A and B have the arrays with have some duplicates values also, but we have to skip the duplicated for only based on func_id of the arrays. In the array C we have push both A and B func_score values based on func_id and func_score_A from A(func_score) array and func_score_B from B(func_score) array.
Sample Code:
var A = [{
"func_id": 1,
"func_score": 0.4
}, {
"func_id": 2,
"func_score": 0.5
}, {
"func_id": 3,
"func_score": 0.7
}];
var B = [{
"func_id": 3,
"func_score": 0.9
}, {
"func_id": 4,
"func_score": 0.7
}, {
"func_id": 5,
"func_score": 0.8
}];
var C = ;
var tmpArray = ;
A.forEach(function(element) {
B.forEach(function(loop) {
if (element.func_id === loop.func_id) {
var tmpObje = {
func_id: element.func_id,
func_sore_A: element.func_score,
func_sore_B: loop.func_score
}
tmpArray.push(tmpObje);
C.push(tmpObje);
return;
}
});
});
A.forEach(function(element) {
tmpArray.forEach(function(loop) {
if (element.func_id !== loop.func_id) {
var smsObj = {
func_id: element.func_id,
func_sore_A: element.func_score,
func_sore_B: 0
}
C.push(smsObj);
return;
}
});
});
B.forEach(function(element) {
tmpArray.forEach(function(loop) {
if (element.func_id !== loop.func_id) {
var domineObj = {
func_id: element.func_id,
func_sore_A: 0,
func_sore_B: loop.func_score
}
C.push(domineObj);
return;
}
});
});
console.log(C);
Expected Output
[
{"func_id": 1,
"func_score_A": 0.4,
"func_score_B":0
},
{"func_id": 2,
"func_score_A": 0.5,
"func_score_B":0
},
{"func_id": 3,
"func_score_A": 0.7,
"func_score_B":0.9
},
{"func_id": 4,
"func_score_A": 0,
"func_score_B":0.7
},
{"func_id": 5,
"func_score_A": 0,
"func_score_B":0.8
}
]
Note:
arrays node.js object arraylist arrayobject
add a comment |
up vote
0
down vote
favorite
I am using Node.js for programming,
In the below array of Objects A and B have the arrays with have some duplicates values also, but we have to skip the duplicated for only based on func_id of the arrays. In the array C we have push both A and B func_score values based on func_id and func_score_A from A(func_score) array and func_score_B from B(func_score) array.
Sample Code:
var A = [{
"func_id": 1,
"func_score": 0.4
}, {
"func_id": 2,
"func_score": 0.5
}, {
"func_id": 3,
"func_score": 0.7
}];
var B = [{
"func_id": 3,
"func_score": 0.9
}, {
"func_id": 4,
"func_score": 0.7
}, {
"func_id": 5,
"func_score": 0.8
}];
var C = ;
var tmpArray = ;
A.forEach(function(element) {
B.forEach(function(loop) {
if (element.func_id === loop.func_id) {
var tmpObje = {
func_id: element.func_id,
func_sore_A: element.func_score,
func_sore_B: loop.func_score
}
tmpArray.push(tmpObje);
C.push(tmpObje);
return;
}
});
});
A.forEach(function(element) {
tmpArray.forEach(function(loop) {
if (element.func_id !== loop.func_id) {
var smsObj = {
func_id: element.func_id,
func_sore_A: element.func_score,
func_sore_B: 0
}
C.push(smsObj);
return;
}
});
});
B.forEach(function(element) {
tmpArray.forEach(function(loop) {
if (element.func_id !== loop.func_id) {
var domineObj = {
func_id: element.func_id,
func_sore_A: 0,
func_sore_B: loop.func_score
}
C.push(domineObj);
return;
}
});
});
console.log(C);
Expected Output
[
{"func_id": 1,
"func_score_A": 0.4,
"func_score_B":0
},
{"func_id": 2,
"func_score_A": 0.5,
"func_score_B":0
},
{"func_id": 3,
"func_score_A": 0.7,
"func_score_B":0.9
},
{"func_id": 4,
"func_score_A": 0,
"func_score_B":0.7
},
{"func_id": 5,
"func_score_A": 0,
"func_score_B":0.8
}
]
Note:
arrays node.js object arraylist arrayobject
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am using Node.js for programming,
In the below array of Objects A and B have the arrays with have some duplicates values also, but we have to skip the duplicated for only based on func_id of the arrays. In the array C we have push both A and B func_score values based on func_id and func_score_A from A(func_score) array and func_score_B from B(func_score) array.
Sample Code:
var A = [{
"func_id": 1,
"func_score": 0.4
}, {
"func_id": 2,
"func_score": 0.5
}, {
"func_id": 3,
"func_score": 0.7
}];
var B = [{
"func_id": 3,
"func_score": 0.9
}, {
"func_id": 4,
"func_score": 0.7
}, {
"func_id": 5,
"func_score": 0.8
}];
var C = ;
var tmpArray = ;
A.forEach(function(element) {
B.forEach(function(loop) {
if (element.func_id === loop.func_id) {
var tmpObje = {
func_id: element.func_id,
func_sore_A: element.func_score,
func_sore_B: loop.func_score
}
tmpArray.push(tmpObje);
C.push(tmpObje);
return;
}
});
});
A.forEach(function(element) {
tmpArray.forEach(function(loop) {
if (element.func_id !== loop.func_id) {
var smsObj = {
func_id: element.func_id,
func_sore_A: element.func_score,
func_sore_B: 0
}
C.push(smsObj);
return;
}
});
});
B.forEach(function(element) {
tmpArray.forEach(function(loop) {
if (element.func_id !== loop.func_id) {
var domineObj = {
func_id: element.func_id,
func_sore_A: 0,
func_sore_B: loop.func_score
}
C.push(domineObj);
return;
}
});
});
console.log(C);
Expected Output
[
{"func_id": 1,
"func_score_A": 0.4,
"func_score_B":0
},
{"func_id": 2,
"func_score_A": 0.5,
"func_score_B":0
},
{"func_id": 3,
"func_score_A": 0.7,
"func_score_B":0.9
},
{"func_id": 4,
"func_score_A": 0,
"func_score_B":0.7
},
{"func_id": 5,
"func_score_A": 0,
"func_score_B":0.8
}
]
Note:
arrays node.js object arraylist arrayobject
I am using Node.js for programming,
In the below array of Objects A and B have the arrays with have some duplicates values also, but we have to skip the duplicated for only based on func_id of the arrays. In the array C we have push both A and B func_score values based on func_id and func_score_A from A(func_score) array and func_score_B from B(func_score) array.
Sample Code:
var A = [{
"func_id": 1,
"func_score": 0.4
}, {
"func_id": 2,
"func_score": 0.5
}, {
"func_id": 3,
"func_score": 0.7
}];
var B = [{
"func_id": 3,
"func_score": 0.9
}, {
"func_id": 4,
"func_score": 0.7
}, {
"func_id": 5,
"func_score": 0.8
}];
var C = ;
var tmpArray = ;
A.forEach(function(element) {
B.forEach(function(loop) {
if (element.func_id === loop.func_id) {
var tmpObje = {
func_id: element.func_id,
func_sore_A: element.func_score,
func_sore_B: loop.func_score
}
tmpArray.push(tmpObje);
C.push(tmpObje);
return;
}
});
});
A.forEach(function(element) {
tmpArray.forEach(function(loop) {
if (element.func_id !== loop.func_id) {
var smsObj = {
func_id: element.func_id,
func_sore_A: element.func_score,
func_sore_B: 0
}
C.push(smsObj);
return;
}
});
});
B.forEach(function(element) {
tmpArray.forEach(function(loop) {
if (element.func_id !== loop.func_id) {
var domineObj = {
func_id: element.func_id,
func_sore_A: 0,
func_sore_B: loop.func_score
}
C.push(domineObj);
return;
}
});
});
console.log(C);
Expected Output
[
{"func_id": 1,
"func_score_A": 0.4,
"func_score_B":0
},
{"func_id": 2,
"func_score_A": 0.5,
"func_score_B":0
},
{"func_id": 3,
"func_score_A": 0.7,
"func_score_B":0.9
},
{"func_id": 4,
"func_score_A": 0,
"func_score_B":0.7
},
{"func_id": 5,
"func_score_A": 0,
"func_score_B":0.8
}
]
Note:
arrays node.js object arraylist arrayobject
arrays node.js object arraylist arrayobject
asked Nov 21 at 15:06
siva
302415
302415
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
up vote
1
down vote
accepted
Here's an approach that might be a little simpler.
var A = [{
"func_id": 1,
"func_score": 0.4
}, {
"func_id": 2,
"func_score": 0.5
}, {
"func_id": 3,
"func_score": 0.7
}];
var B = [{
"func_id": 3,
"func_score": 0.9
}, {
"func_id": 4,
"func_score": 0.7
}, {
"func_id": 5,
"func_score": 0.8
}];
let C = A.map(e => {
return {
func_id: e.func_id,
func_score_A: e.func_score,
func_score_B: 0
};
});
B.forEach(e => {
let i = C.findIndex(x => x.func_id == e.func_id);
if (i >= 0) {
C[i].func_score_B = e.func_score;
} else {
C.push({
func_id: e.func_id,
func_score_A: 0,
func_score_B: e.func_score
})
}
});
console.log(C);
Hi Jim B , Your approach working fine like exactly what i want. Thank you so much.
– siva
Nov 22 at 9:14
add a comment |
up vote
0
down vote
Your bug is quite simple, first replace all sore
with score
. Then in your B.forEach()
loop, you possibly made the mistake of taking loop.func_score
instead of element.func_score
.
B.forEach(function(element) {
tmpArray.forEach(function(loop) {
if (element.func_id !== loop.func_id) {
var domineObj = {
func_id: element.func_id,
func_sore_A: 0,
// loop should be element
// func_sore_B: loop.func_score
func_sore_B: element.func_score
}
C.push(domineObj);
return;
}
});
});
Hi ssemilla, even i changed the code as per you suggestion but still i didn't get Expected Output but,below another guy Mr Jim given another little simpler approach , its working fine. Any way thank you for your stuff.
– siva
Nov 22 at 9:13
Sure, I also suggest just simplifying your code.
– ssemilla
Nov 22 at 9:15
add a comment |
up vote
-1
down vote
You can do this without all the code below just do var C = A.concat(B)
var A = [{
"func_id": 1,
"func_score": 0.4
}, {
"func_id": 2,
"func_score": 0.5
}, {
"func_id": 3,
"func_score": 0.7
}];
var B = [{
"func_id": 3,
"func_score": 0.9
}, {
"func_id": 4,
"func_score": 0.7
}, {
"func_id": 5,
"func_score": 0.8
}];
//check the console for output
console.log(A.concat(B));
working example: https://jsfiddle.net/1e304w7t/
Hi Rick ,A.concat(B) is not correct solution, Kindly see the Expected Output
– siva
Nov 21 at 16:32
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Here's an approach that might be a little simpler.
var A = [{
"func_id": 1,
"func_score": 0.4
}, {
"func_id": 2,
"func_score": 0.5
}, {
"func_id": 3,
"func_score": 0.7
}];
var B = [{
"func_id": 3,
"func_score": 0.9
}, {
"func_id": 4,
"func_score": 0.7
}, {
"func_id": 5,
"func_score": 0.8
}];
let C = A.map(e => {
return {
func_id: e.func_id,
func_score_A: e.func_score,
func_score_B: 0
};
});
B.forEach(e => {
let i = C.findIndex(x => x.func_id == e.func_id);
if (i >= 0) {
C[i].func_score_B = e.func_score;
} else {
C.push({
func_id: e.func_id,
func_score_A: 0,
func_score_B: e.func_score
})
}
});
console.log(C);
Hi Jim B , Your approach working fine like exactly what i want. Thank you so much.
– siva
Nov 22 at 9:14
add a comment |
up vote
1
down vote
accepted
Here's an approach that might be a little simpler.
var A = [{
"func_id": 1,
"func_score": 0.4
}, {
"func_id": 2,
"func_score": 0.5
}, {
"func_id": 3,
"func_score": 0.7
}];
var B = [{
"func_id": 3,
"func_score": 0.9
}, {
"func_id": 4,
"func_score": 0.7
}, {
"func_id": 5,
"func_score": 0.8
}];
let C = A.map(e => {
return {
func_id: e.func_id,
func_score_A: e.func_score,
func_score_B: 0
};
});
B.forEach(e => {
let i = C.findIndex(x => x.func_id == e.func_id);
if (i >= 0) {
C[i].func_score_B = e.func_score;
} else {
C.push({
func_id: e.func_id,
func_score_A: 0,
func_score_B: e.func_score
})
}
});
console.log(C);
Hi Jim B , Your approach working fine like exactly what i want. Thank you so much.
– siva
Nov 22 at 9:14
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Here's an approach that might be a little simpler.
var A = [{
"func_id": 1,
"func_score": 0.4
}, {
"func_id": 2,
"func_score": 0.5
}, {
"func_id": 3,
"func_score": 0.7
}];
var B = [{
"func_id": 3,
"func_score": 0.9
}, {
"func_id": 4,
"func_score": 0.7
}, {
"func_id": 5,
"func_score": 0.8
}];
let C = A.map(e => {
return {
func_id: e.func_id,
func_score_A: e.func_score,
func_score_B: 0
};
});
B.forEach(e => {
let i = C.findIndex(x => x.func_id == e.func_id);
if (i >= 0) {
C[i].func_score_B = e.func_score;
} else {
C.push({
func_id: e.func_id,
func_score_A: 0,
func_score_B: e.func_score
})
}
});
console.log(C);
Here's an approach that might be a little simpler.
var A = [{
"func_id": 1,
"func_score": 0.4
}, {
"func_id": 2,
"func_score": 0.5
}, {
"func_id": 3,
"func_score": 0.7
}];
var B = [{
"func_id": 3,
"func_score": 0.9
}, {
"func_id": 4,
"func_score": 0.7
}, {
"func_id": 5,
"func_score": 0.8
}];
let C = A.map(e => {
return {
func_id: e.func_id,
func_score_A: e.func_score,
func_score_B: 0
};
});
B.forEach(e => {
let i = C.findIndex(x => x.func_id == e.func_id);
if (i >= 0) {
C[i].func_score_B = e.func_score;
} else {
C.push({
func_id: e.func_id,
func_score_A: 0,
func_score_B: e.func_score
})
}
});
console.log(C);
var A = [{
"func_id": 1,
"func_score": 0.4
}, {
"func_id": 2,
"func_score": 0.5
}, {
"func_id": 3,
"func_score": 0.7
}];
var B = [{
"func_id": 3,
"func_score": 0.9
}, {
"func_id": 4,
"func_score": 0.7
}, {
"func_id": 5,
"func_score": 0.8
}];
let C = A.map(e => {
return {
func_id: e.func_id,
func_score_A: e.func_score,
func_score_B: 0
};
});
B.forEach(e => {
let i = C.findIndex(x => x.func_id == e.func_id);
if (i >= 0) {
C[i].func_score_B = e.func_score;
} else {
C.push({
func_id: e.func_id,
func_score_A: 0,
func_score_B: e.func_score
})
}
});
console.log(C);
var A = [{
"func_id": 1,
"func_score": 0.4
}, {
"func_id": 2,
"func_score": 0.5
}, {
"func_id": 3,
"func_score": 0.7
}];
var B = [{
"func_id": 3,
"func_score": 0.9
}, {
"func_id": 4,
"func_score": 0.7
}, {
"func_id": 5,
"func_score": 0.8
}];
let C = A.map(e => {
return {
func_id: e.func_id,
func_score_A: e.func_score,
func_score_B: 0
};
});
B.forEach(e => {
let i = C.findIndex(x => x.func_id == e.func_id);
if (i >= 0) {
C[i].func_score_B = e.func_score;
} else {
C.push({
func_id: e.func_id,
func_score_A: 0,
func_score_B: e.func_score
})
}
});
console.log(C);
edited Nov 21 at 21:18
answered Nov 21 at 20:57
Jim B.
2,6261928
2,6261928
Hi Jim B , Your approach working fine like exactly what i want. Thank you so much.
– siva
Nov 22 at 9:14
add a comment |
Hi Jim B , Your approach working fine like exactly what i want. Thank you so much.
– siva
Nov 22 at 9:14
Hi Jim B , Your approach working fine like exactly what i want. Thank you so much.
– siva
Nov 22 at 9:14
Hi Jim B , Your approach working fine like exactly what i want. Thank you so much.
– siva
Nov 22 at 9:14
add a comment |
up vote
0
down vote
Your bug is quite simple, first replace all sore
with score
. Then in your B.forEach()
loop, you possibly made the mistake of taking loop.func_score
instead of element.func_score
.
B.forEach(function(element) {
tmpArray.forEach(function(loop) {
if (element.func_id !== loop.func_id) {
var domineObj = {
func_id: element.func_id,
func_sore_A: 0,
// loop should be element
// func_sore_B: loop.func_score
func_sore_B: element.func_score
}
C.push(domineObj);
return;
}
});
});
Hi ssemilla, even i changed the code as per you suggestion but still i didn't get Expected Output but,below another guy Mr Jim given another little simpler approach , its working fine. Any way thank you for your stuff.
– siva
Nov 22 at 9:13
Sure, I also suggest just simplifying your code.
– ssemilla
Nov 22 at 9:15
add a comment |
up vote
0
down vote
Your bug is quite simple, first replace all sore
with score
. Then in your B.forEach()
loop, you possibly made the mistake of taking loop.func_score
instead of element.func_score
.
B.forEach(function(element) {
tmpArray.forEach(function(loop) {
if (element.func_id !== loop.func_id) {
var domineObj = {
func_id: element.func_id,
func_sore_A: 0,
// loop should be element
// func_sore_B: loop.func_score
func_sore_B: element.func_score
}
C.push(domineObj);
return;
}
});
});
Hi ssemilla, even i changed the code as per you suggestion but still i didn't get Expected Output but,below another guy Mr Jim given another little simpler approach , its working fine. Any way thank you for your stuff.
– siva
Nov 22 at 9:13
Sure, I also suggest just simplifying your code.
– ssemilla
Nov 22 at 9:15
add a comment |
up vote
0
down vote
up vote
0
down vote
Your bug is quite simple, first replace all sore
with score
. Then in your B.forEach()
loop, you possibly made the mistake of taking loop.func_score
instead of element.func_score
.
B.forEach(function(element) {
tmpArray.forEach(function(loop) {
if (element.func_id !== loop.func_id) {
var domineObj = {
func_id: element.func_id,
func_sore_A: 0,
// loop should be element
// func_sore_B: loop.func_score
func_sore_B: element.func_score
}
C.push(domineObj);
return;
}
});
});
Your bug is quite simple, first replace all sore
with score
. Then in your B.forEach()
loop, you possibly made the mistake of taking loop.func_score
instead of element.func_score
.
B.forEach(function(element) {
tmpArray.forEach(function(loop) {
if (element.func_id !== loop.func_id) {
var domineObj = {
func_id: element.func_id,
func_sore_A: 0,
// loop should be element
// func_sore_B: loop.func_score
func_sore_B: element.func_score
}
C.push(domineObj);
return;
}
});
});
edited Nov 22 at 5:47
answered Nov 22 at 3:47
ssemilla
2,687423
2,687423
Hi ssemilla, even i changed the code as per you suggestion but still i didn't get Expected Output but,below another guy Mr Jim given another little simpler approach , its working fine. Any way thank you for your stuff.
– siva
Nov 22 at 9:13
Sure, I also suggest just simplifying your code.
– ssemilla
Nov 22 at 9:15
add a comment |
Hi ssemilla, even i changed the code as per you suggestion but still i didn't get Expected Output but,below another guy Mr Jim given another little simpler approach , its working fine. Any way thank you for your stuff.
– siva
Nov 22 at 9:13
Sure, I also suggest just simplifying your code.
– ssemilla
Nov 22 at 9:15
Hi ssemilla, even i changed the code as per you suggestion but still i didn't get Expected Output but,below another guy Mr Jim given another little simpler approach , its working fine. Any way thank you for your stuff.
– siva
Nov 22 at 9:13
Hi ssemilla, even i changed the code as per you suggestion but still i didn't get Expected Output but,below another guy Mr Jim given another little simpler approach , its working fine. Any way thank you for your stuff.
– siva
Nov 22 at 9:13
Sure, I also suggest just simplifying your code.
– ssemilla
Nov 22 at 9:15
Sure, I also suggest just simplifying your code.
– ssemilla
Nov 22 at 9:15
add a comment |
up vote
-1
down vote
You can do this without all the code below just do var C = A.concat(B)
var A = [{
"func_id": 1,
"func_score": 0.4
}, {
"func_id": 2,
"func_score": 0.5
}, {
"func_id": 3,
"func_score": 0.7
}];
var B = [{
"func_id": 3,
"func_score": 0.9
}, {
"func_id": 4,
"func_score": 0.7
}, {
"func_id": 5,
"func_score": 0.8
}];
//check the console for output
console.log(A.concat(B));
working example: https://jsfiddle.net/1e304w7t/
Hi Rick ,A.concat(B) is not correct solution, Kindly see the Expected Output
– siva
Nov 21 at 16:32
add a comment |
up vote
-1
down vote
You can do this without all the code below just do var C = A.concat(B)
var A = [{
"func_id": 1,
"func_score": 0.4
}, {
"func_id": 2,
"func_score": 0.5
}, {
"func_id": 3,
"func_score": 0.7
}];
var B = [{
"func_id": 3,
"func_score": 0.9
}, {
"func_id": 4,
"func_score": 0.7
}, {
"func_id": 5,
"func_score": 0.8
}];
//check the console for output
console.log(A.concat(B));
working example: https://jsfiddle.net/1e304w7t/
Hi Rick ,A.concat(B) is not correct solution, Kindly see the Expected Output
– siva
Nov 21 at 16:32
add a comment |
up vote
-1
down vote
up vote
-1
down vote
You can do this without all the code below just do var C = A.concat(B)
var A = [{
"func_id": 1,
"func_score": 0.4
}, {
"func_id": 2,
"func_score": 0.5
}, {
"func_id": 3,
"func_score": 0.7
}];
var B = [{
"func_id": 3,
"func_score": 0.9
}, {
"func_id": 4,
"func_score": 0.7
}, {
"func_id": 5,
"func_score": 0.8
}];
//check the console for output
console.log(A.concat(B));
working example: https://jsfiddle.net/1e304w7t/
You can do this without all the code below just do var C = A.concat(B)
var A = [{
"func_id": 1,
"func_score": 0.4
}, {
"func_id": 2,
"func_score": 0.5
}, {
"func_id": 3,
"func_score": 0.7
}];
var B = [{
"func_id": 3,
"func_score": 0.9
}, {
"func_id": 4,
"func_score": 0.7
}, {
"func_id": 5,
"func_score": 0.8
}];
//check the console for output
console.log(A.concat(B));
working example: https://jsfiddle.net/1e304w7t/
answered Nov 21 at 15:14
Rick Grendel
50119
50119
Hi Rick ,A.concat(B) is not correct solution, Kindly see the Expected Output
– siva
Nov 21 at 16:32
add a comment |
Hi Rick ,A.concat(B) is not correct solution, Kindly see the Expected Output
– siva
Nov 21 at 16:32
Hi Rick ,A.concat(B) is not correct solution, Kindly see the Expected Output
– siva
Nov 21 at 16:32
Hi Rick ,A.concat(B) is not correct solution, Kindly see the Expected Output
– siva
Nov 21 at 16:32
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53414948%2fhow-to-merge-array-of-objects-a-and-b-and-form-array-of-object-c-contains-new-ke%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown