javascript - Combine two arrays into an object in JSON -
column_names: [ "school year ending", "total students", "american indian/alaskan native: total", "american indian/alaskan native: male", "american indian/alaskan native: female", "asian/pacific islander: total", "asian/pacific islander: male", "asian/pacific islander: female", "hispanic: total", "hispanic: male", "hispanic: female", "black: total", "black: male", "black: female", "white: total", "white: male", "white: female" ], data: [ "2011-12-31", 3471888, 39433, 19926, 19507, 182697, 94104, 88593, 686081, 344910, 341171, 536271, 260720, 275551, 1970983, 1006592, 964391 ]
is there way turn these 2 json arrays object format? instance:
"school year ending": "2011-12-31", "total students": 3721888, ...
i'd prefer using lo-dash function convenience. there this?
_.zipobject(column_names, data);
should it.
Comments
Post a Comment