PDA

View Full Version : Trouble with json reader



sarabjeetd
21 Feb 2012, 12:34 PM
I have a simple format which is refusing to load in json format.
The store defnition and json data files are as follows:
Firefox 10.0.2 reports: "not well-formed"
I am using glassfish 3.x to deploy the app.


{
"results": [
{
"name": "latency",
"data1": 5,
"data2": 10,
"data3": 5,
"data4": 10,
"data5": 10
},
{
"name": "cpu avg",
"data1": 5,
"data2": 10,
"data3": 5,
"data4": 10,
"data5": 10
},
{
"name": "disk io",
"data1": 5,
"data2": 10,
"data3": 5,
"data4": 10,
"data5": 10
},
{
"name": "roundtrip",
"data1": 5,
"data2": 10,
"data3": 5,
"data4": 10,
"data5": 10
},
{
"name": "heap size",
"data1": 5,
"data2": 10,
"data3": 5,
"data4": 10,
"data5": 10
}
]
}


Ext.define('DiagApp.store.ProbeStore', {
extend: 'Ext.data.Store',
model: 'DiagApp.model.ProbeModel',
alias: 'widget.store.ProbeStore',
autoLoad: true,



proxy : {
type: 'ajax',
url: 'app/data/ProbeStore.json',
reader : {
type: 'json',
root: 'results',
idProperty: 'name'
}
},
fields: [ 'name',
{ name: 'data1', type : 'int' },
{ name: 'data2', type : 'int' },
{ name: 'data3', type : 'int' },
{ name: 'data4', type : 'int' },
{ name: 'data5', type : 'int' }
]

});

mitchellsimoens
21 Feb 2012, 12:50 PM
Works for me on FF 10. I had to remove the models property on the Store as I don't have that but it all worked for me.

sarabjeetd
21 Feb 2012, 2:04 PM
I removed the model property from the ProbeStore.js. I still get the "not well-formed" error.
Are there any requirements on line-feed character or format (unix vs windows) for ProbeStore.json file?

-Sarab

shethvoss
9 Apr 2012, 6:03 AM
Also, check to make sure it's running from the server (e.g. http://localhost/~me/Sites/app/index.html) vs file system (e.g. file://Users/me/Sites/app/index.html) as that can give the same error message. The tutorial works fine before that point either way.

See http://www.sencha.com/forum/showthread.php?144908-Ext-Designer-returning-not-well-formed-error-on-exported-pages&highlight=well-formed