i having complete brain fail today , cannot figure out how combine 2 json objects instagram api.
they little this:
{ "pagination": { ... }, "meta": { ... }, "data": [ { ... }, { ... }, { ... }, ] } the way instagram api works send maximum of 20 data items @ time, sends "next_url" parameter inside of "pagination" know there still more get.
i want add "data" section of each object 1 big object can loop through these , map them on google map in 1 go.
to give example:
obj1 = { "pagination": { ... }, "meta": { ... }, "data": [ { ... }, { ... }, { ... } ] } obj2 = { "pagination": { ... }, "meta": { ... }, "data": [ { ... }, { ... }, { ... } ] } the result:
obj3 = { "data": [ { ... }, { ... }, { ... }, { ... }, { ... }, { ... } ] } the "pagination" , "meta" sections not need merged together, need big long list of data.
i hope can help, if need more info / data please ask.
edit
i have realised not need obj3 , brian's answer have come solution:
obj1 = { data: [] }; obj1.data = obj1.data.concat(obj2.data); thanks brian
i think need if understand question right:
obj3 = obj1; obj1.data = obj2.data.concat(obj2.data) basically concatenate arrays. issue if there's duplicates merge, sounds it's simple adding of lists?
Comments
Post a Comment