I have an array of data. In a
there are 10 fields and in b
there are 10 fields
var a = [ "siddharth", "sid", "anything", "something", "nothing", ]
var b = [ "23", "67", "10", "10", "90" ]
I am trying to create a JSON
from these arrays as a
as the key and b
as values, as shown below:
{ "siddharth" : "23", "sid" : "67" }
How can I achieve this using javascript
or jquery
. My current code is
var convert = '{'+datatest.columnHeaders[i].name +":"+datatest.rows[0][i]+'}';
pair = convert;/*JSON.stringify(convert);*/
array.pairArray.push(pair);