Extjs 如何在javascript中解析json对象

Extjs 如何在javascript中解析json对象,extjs,ext4,Extjs,Ext4,我有两个JSON对象,我必须在ExtJs网格中显示这是我的网格,我从Servlet获取的数据是一个空网格 //getting the response from Servlet var proxy=new Ext.data.HttpProxy({url:'LoginServlet'}); // this is the Servlet var reader=new Ext.data.JsonReader( //store { },[ {name:'username',m

我有两个JSON对象,我必须在ExtJs网格中显示这是我的网格,我从Servlet获取的数据是一个空网格

//getting the response from Servlet

 var proxy=new Ext.data.HttpProxy({url:'LoginServlet'}); // this is the Servlet


var reader=new Ext.data.JsonReader( //store 

 {

 },[
     {name:'username',mapping:'username'}, //field s of Grid
     {name:'password'}//

   var store=new Ext.data.Store({  //data Store 

  proxy:proxy, //proxy
  reader:reader,//
  root:"obj" //
   });

   store.load(); //loding the store


   var grid=new Ext.grid.GridPanel({   //creating the Grid panel

   store:store,//
   columns:[

       {header:"username",width:60,dataIndex:'username'}, //setting 
       {header:"password",width:60,dataIndex:'password'}
   ],
   renderTo:Ext.getBody(),
   width:420, //
   height:200

JSONObject obj=新的JSONObject();obj.put(“username”,UserVO.getUsername());obj.put(“password”,UserVO.getPassword())//这是我的json objectOk,那么问题是什么呢?我得到的是一个空网格,您从服务器发送的数据正确吗?你能发布一些吗;JSONObject obj=新的JSONObject();obj.put(“username”,UserVO.getUsername());obj.put(“password”,UserVO.getPassword())//out.println(obj);JSONArray json=新的JSONArray();json.add(obj);put(“obj”,json);