简体   繁体   中英

How to convert rest web service call returns xml into json in sencha

Webservice request returns XML. How do I convert this into JSON in sencha touch and then load the data into a list? How can I also choose which information could be stored in the local storage?

first you need to create model and store for that.

you can create model like this,

 Ext.regModel('Travel', {
  idProperty: 'Travelled',
   fields: [ { name: 'Month', type: 'string' },
         { name: 'Travel', type: 'int' },
         { name: 'Addition', type: 'int' },
         { name: 'Traveled', type: 'int' },
         { name: 'outcome', type: 'int' }]
   });

and stor like this

 Ext.regStore('TravelStore', {
model: 'Travel',
storeId: "TravelID"
});

and you need to pass the data into this store by using arrays with the help of Xml response.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM