I have a 2-D list from a server URL which has a format of
[["John",5,7,"something1"],
["David",4,2,"something2"],etc]
Is there a fast way to parse this list to a proper JSON format with assigned key pairs as follows?
[{name:"John",
numbercolumn1:5,
numbercolumn2:7,
description:"something1"},
{},{}]
"John,5,7,"something1"...17 items in totalis invalid string notation{"0": "name", "1": "numbercolumn1", "2": "numbercolumn2", "3":"description" ... }and then iterate over your outer array, and your inner array, mapping the numbered indexes to the new field names.for ( var i = 0, l = innerArray.length; i < l; i++) { newObj[mappingArray['' + i]] = innerArray[i]; }