Considering the following two arrays. How can I append array "lines" to array "array1". I have tried .push but it appends outside of the array. I have also tried .unshift which doesn't give me the wanted result.
array1 = [
{
"Activity #": "1111111",
"Customer": "Last, First",
"Tenure": "0 Year 2 Months",
"Account #": "0000000"
}];
lines = [
{
"Line #": "1",
"Action Required": "New",
"Status": "Closed",
"Product Line": "test line1",
"Product": "product1"
},
{
"Line #": "2",
"Action Required": "New",
"Status": "Closed",
"Product Line": "test line2",
"Product": "product2"
}];
I would like something like this.
my_array = [
{
"Activity #": "1111111",
"Customer": "Last, First",
"Tenure": "0 Year 2 Months",
"Account #": "0000000",
"lines": [{
"Line #": "1",
"fields": "keys"
},
{
"Line #": "2",
"fields": "keys"
}]
}]
With the mentioned used methods I get something like.
my_array = [
{
"Activity #": "1111111",
"Customer": "Last, First",
"Tenure": "0 Year 2 Months",
"Account #": "0000000"
}, [
{
"Line #": "1",
"fields": "keys"
}, {
"Line #": "2",
"fields": "keys"
}]
];
Hope someone can help and my question is clear.