Search code examples
javascriptjsonxmlodatasapui5

sapui5 JSON model and display in xml


I need help with setting JSON model into my main model. I have data stored in "http://localhost:9041/main-app-web/MyServiceName.svc/GetSurname?id=1&name='matt'&$format=json"

Now i want to set it into model, i'm trying

var oModelJs = new sap.ui.model.json.JSONModel("/main-app-web/MyServiceName.svc/GetSurname?id=1&name='matt'&$format=json");
this.getView().setModel(oModelJs, "model");

but it is giving me oData ={} , enter image description here empty oData in debugger. How could i do that and then display my data eg. in table in xml?

Parameters stored in my json:

Id: "223",
MeterNumber: "1354-65498121"

Ty guys


Solution

  • The way i solved this problem was adding correct items into <Table items="{/d/results}"> and in cells <Text text="{id}" /> Ty for ur response santosh.