jeudi 4 décembre 2014

JSON not parsing into model

Hi

I am sure I am missing something here but I am parsing some json and ONE field never gets parsed into the record.


the field "caTypeDescription" is always empty as can be seen from an example of the data below



Code:



data: Object
announcementId: 8121
caType: "DVOP"
caTypeDescription: ""
createdBy: ""
dateCreated: null
financialYearEnd: ""
id: "iActs.model.Announcements-2"
issuerDetails: Object
issuerName: "TESTENTITY"
mandVolChoiceFlag: "M"
securitiesId: 0
updateTypeFlag: "NEWM"

My model is as so


Code:



Ext.define('iActs.model.Announcements', {
extend : 'Ext.data.Model',
id : 'announcementId',
fields : [ {
name : 'announcementId',
type : 'int'
}, {
name : 'securitiesId',
type : 'int'
}, {
name : 'issuerName',
type : 'string',
mapping : 'issuerDetails.name'
}, {
name : 'caType',
type : 'string',
mapping : 'caType.caType'
}, {
name : 'caTypeDescription',
type : 'string',
mapping : 'caType.description'
}, {
name : 'mandVolChoiceFlag',
type : 'string'
}, {
name : 'updateTypeFlag',
type : 'string'
}, {
name : 'financialYearEnd',
type : 'string'
}, {
name : 'dateCreated',
type : 'date'
}, {
name : 'createdBy',
type : 'string'
}]
});

and the JSON


Code:



{"root": [
{
"announcementId": 8121,
"issuerDetails": {
"entity": "XX",
"name": "TESTENTITY",
"issuerId": "ISSUER01"
},
"caType": {
"caType": "DVOP",
"description": "Dividend Option"
},
"mandVolChoiceFlag": "M",
"updateTypeFlag": "NEWM",
"financialYearEnd": null,
"dateCreated": null,
"createdBy": null
}
]}

As you can see caType.caType is parsed, but caType.description on this and every other record I have tried is blank.

Either it is a bug or I am missing something so any help would be appreciated as this is driving me up the wall!

Thanks in advance






JSON not parsing into model

Aucun commentaire:

Enregistrer un commentaire