1

I'm trying to mix this objects which contain an array:

var a = {[
    {...},
    {...},
    {...}
]};

var b = {[
    {...},
    {...},
    {...}
]};

in one level array:

[
    {...},
    {...},
    {...},
    {...},
    {...},
    {...}
];

In JavaScript, I'm trying this without success:

var arr = a.concat(b);

because this gives me:

[
    {[
      {...},
      {...},
      {...}
    ]},
    {[
      {...},
      {...},
      {...}
    ]}
]

how can I obtain one level array?

vitto
  • 19,094
  • 31
  • 91
  • 130

1 Answers1

4

That's because a and b are not arrays. Assuming you can modify the json format (and you should as it's not valid) you could change it for this

var a = [
    {...},
    {...},
    {...}
];

var b = [
    {...},
    {...},
    {...}
];

Then your code would work just fine

Claudio Redi
  • 67,454
  • 15
  • 130
  • 155