4
votes

I am new to Sencha Touch and now engaged in creating some complex banking solutions using Sencha touch for mobile platforms. I have worked a lot with jQuery, but new to the Sencha framework. My question is, does sencha touch has any specific json format or it will accept any valid javascript object notation?

For example, given below is an object notation

{"user": [{"name": "yyy","age": "10"},{"name": "xxx","age": "20"},{"name": "zzz","age": "30"}]}

I am able to bind the above set of data to the sencha DataView, but i am not able to bind the JSON in the format below

{"data": [["xxx","10"],["yyy","20"],["zzz","30"]]}

Why does this happen? Is sencha looking for an exact key, value pair format? Or does it have any alternate option in Sencha?

Any help would be appreciated.

1
JSON.stringify one method is there you just try that oneGayathri Mohan

1 Answers

6
votes

Ext.data.reader.Json expects the input to be formatted as your first example. If you have only second format avialble, you could for example use Ext.data.reader.Array after first passing it thorough Ext.decode() to parse JSON into actual JS object.