javascript - Missing quotes in JSON object. How to add them in? -
i've got slight problem when passing parsed json variabled through jqgrid. querying ms access .mdb file. problem there id field autonumber integer field in ms access , not have quotes when queried. jqgrid doesn't , that's why not showing id value in table.
var sql = "select * test"; var resultset = mydb.query(sql); // resultset yield [{"id":1,"name":"albert","9999999999"},{"id":2,"name":"peter","8888888888"}] var mydata = json.parse(resultset)
notice above how resultset not have quotes on id value rest do. resulting in table without value in id column. how add quotes id value before get's parsed via json?
thank you.
whole code..
jqgrid can work integers strings. don't need change numbers strings. json posted in previous question contains id
instead of id
. javascript case sensitive language. suppose see values in id
column if replace
{name:'id',index:'id', width:60, sortable:false},
to
{name:'id', width:60, sortable:false},
additionally recommend remove index
property commodel
.
Comments
Post a Comment