Skip to Content
0
Mar 07, 2015 at 09:50 AM

Issue loading Json data : parsererror

513 Views

Hi,

In my application i need to load data from Json file to display in dropdown but getting below error -

Error -

The following problem occurred: parsererror - {

Card: [

{Description: "Switch", enabled: true},

{Description: "Master", enabled: true},

{Description: "VISA", enabled: true},

{Description: "Default", enabled: true},

]

}

,200,OK

My code is below -

// Create instance of JSON model

oCardModel = new sap.ui.model.json.JSONModel();

// Load JSON in model

oCardModel.loadData("models/Card.json"); ==========> (json file is available at WebContent/models/Card.json location)

//Card Type

var oCardType = new sap.ui.commons.DropdownBox({

id: "CardType",

tooltip: "Card Type",

});

var oListCard = new sap.ui.core.ListItem();

oListCard.bindProperty("text", "Description");

oListCard.bindProperty("enabled", "enabled")

// Bind model to table control

oCardType.setModel(oCardModel);

oCardType.bindItems("/Card",oListCard );

Can someone please help.