One minute
Create a JSON array dynamically Javascript
👴 Careful You’re reading an old article ! Some links might be broken and content may be outdated
Using only Javascript
var res = [];
for (var i = 0; i < results.rows.length; i++) {
res[i] = {};
res[i]['id'] = "foo";
res[i]['name'] = "woohoo";
}
Read other posts