on 04-27-2017 7:24 PM
I am trying consume the OData format Json below, but I don't know what is the "path"
{"d":{"__metadata":{"id":"http://xxxx:xxxx/sap/opu/odata/sap/ZGW_TRANSF_APPROVAL_SRV_02/zget('xxxx')","uri":"http://xxxx:xxxx/sap/opu/odata/sap/ZGW_TRANSF_APPROVAL_SRV_02/zget('xxxx')","type":"ZGW_TRANSF_APPROVAL_SRV_02.zget_name"},"login":"RUBENS","name":"RUBENS"}}
Can someone help me to found the "path" in this Json?
This is pretty basic JSON info you can find in most any JSON tutorial....ie "how to reference elements in JSON?"
{
"d": {
"__metadata": {
"id": "http://xxxx:xxxx/sap/opu/odata/sap/ZGW_TRANSF_APPROVAL_SRV_02/zget('xxxx')",
"uri": "http://xxxx:xxxx/sap/opu/odata/sap/ZGW_TRANSF_APPROVAL_SRV_02/zget('xxxx')",
"type": "ZGW_TRANSF_APPROVAL_SRV_02.zget_name"
},
"login": "RUBENS",
"name": "RUBENS"
}
}
so "login" would be...
['d']['login']
you can use this site too which will help you...
JSONPath expression tester
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Christopher,
I am trying consume this JSON in SAPUI5.
Below is my code
//call the OData
var sServiceUrl = "http://xxxx:xxxx/sap/opu/odata/sap/ZGW_TRANSF_APPROVAL_SRV_02";
var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, true, "user", "pass");
var oJsonModel = new sap.ui.model.json.JSONModel();
oModel.read("/zget('RUBENS')", null, null, true, function(oData, response) {
oJsonModel.setData(oData);
//set the items
items: {
path: "/d",
template: new sap.m.StandardListItem({
title: "{name} ({login})",
active: true
})
}
I run in eclipse and in ABAP server, but it is not get any data.
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.