I’ve just started learning Sencha Touch. Trying to build a simple news reader app. But the app is unable to parse the JSON provided. Can someone please help me find the fault in this structure?
[{
'category': 'int',
'image': 'app/Views/images/img1.jpg',
'title': 'News title 1',
'date': '22 Oct 2011',
'desc': 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit.',
'fullStory': 'Ut wisi enim ad minim veniam, quis nostrud.'},
{'category': 'nat',
'image': 'app/Views/images/img2.jpg',
'title': 'News title 2',
'date': '23 Oct 2011',
'desc': 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit.',
'fullStory': 'Ut wisi enim ad minim veniam, quis nostrud.'}]
The app’s model & store are as given below
Ext.regModel('newsModel',{
fields:[
{ name: 'category', type: 'string'},
{ name: 'image', type: 'string'},
{ name: 'title', type: 'string'},
{ name: 'date', type: 'string'},
{ name: 'desc', type: 'string'},
{ name: 'fullStory', type: 'string'}
]});
AppName.newsStore = new Ext.data.TreeStore({
model: 'newsModel',
proxy: {
type: 'ajax',
url: 'app/Models/data/data.json',
reader:{
type: 'json'
}
}});
Error returned by Safari is – “Ext.data.JsonReader.getResponseData: Unable to parse JSON returned by Server.”
Try using ” or no character for property name.