I'm developing a web application with jax-rs, i made a rest client with jquery. I'm getting the result as json or xml, then showing them to html table. To facilitate table, im using JqGrid library. My problem is, for example Jqgrid wants to json object like below ;
[
{yaziNo:"1",yazar:"abc",yazi:"test",tarih:"2007-10-01"},
{yaziNo:"2",yazar:"cdfe",yazi:"test2",tarih:"2007-10-01"},
{yaziNo:"3",yazar:"cdfe",yazi:"test3",tarih:"2007-10-01"},
{yaziNo:"4",yazar:"abc",yazi:"test",tarih:"2007-10-01"},
{yaziNo:"5",yazar:"cdfe",yazi:"test2",tarih:"2007-10-01"},
{yaziNo:"6",yazar:"abc",yazi:"test3",tarih:"2007-10-01"},
{yaziNo:"7",yazar:"cdfe",yazi:"test",tarih:"2007-10-01"},
{yaziNo:"8",yazar:"abc",yazi:"test2",tarih:"2007-10-01"},
{yaziNo:"9",yazar:"abc",yazi:"test3",tarih:"2007-10-01"} ]
But, returned JSON from my rest server those like below;
{"yazi":
[{"tarih":"26.01.2012","yazar":"sdasdadsadasda","yazi":"gdfgdfgd","yaziNo":"1756"},
{"tarih":"26.01.2012","yazar":"sdasdadsadasda","yazi":"gdfgdfgd","yaziNo":"1755"},
{"tarih":"26.01.2012","yazar":"sdasdadsadasda","yazi":"gdfgdfgd","yaziNo":"1754"},
{"tarih":"26.01.2012","yazar":"sdasdadsadasda","yazi":"gdfgdfgd","yaziNo":"1753"},
{"tarih":"26.01.2012","yazar":"sdasdadsadasda","yazi":"gdfgdfgd","yaziNo":"1752"}]
}
How can i delete the "yazi" node but keeping inside.
edited:
jQuery("#list27").jqGrid({
url:'http://localhost:43842/KodcuComRESTful/kodcuRS/yazilar',
datatype: "json",
height: 255,
width: 700,
jsonReader: {root: "yazi", repeatitems: false},
colNames:['Yazi No','Yazar', 'Yazi', 'Tarih'],
colModel:[
{name:'yaziNo',index:'yaziNo', width:80, sorttype:"int"},
{name:'yazar',index:'yazar', width:180},
{name:'yazi',index:'yazi', width:370},
{name:'tarih',index:'tarih', width:100, align:"right",sortype:"date"}
],
rowNum:10,
rowTotal: 2000,
rowList : [20,30,50],
loadonce:true,
mtype: "GET",
rownumbers: true,
rownumWidth: 40,
gridview: true,
pager: '#pager27',
sortname: 'yaziNo',
viewrecords: true,
sortorder: "asc",
caption: "Loading data from server at once"
});