Hi everyone,
I am using database API of MCS to retrieve the rows. I am calling this database API from my custom API. I am receiving the following json :
{
"items": [
{
"srId": 1,
"asset": "DTF35001",
"assignedDepartment": 1
},
{
"srId": 2,
"asset": "DTF35002",
"assignedDepartment": 2
}
]
}
I want to change this json to following :
{
"items": [
{
"srId": 1,
"asset": {
"assetNumber": "DTF35001"
},
"assignedDepartment": 1
},
{
"srId": 2,
"asset": {
"assetNumber": "DTF35001\2"
},
"assignedDepartment": 2
}
]
}
How can I do so in node.js? I am using the following code :
service.get('/mobile/custom/fixedmmdb/servicerequest', function(req,res) {
var handler = function (error, response, body) {
if (error) {
res.send(500, error.message);
} else {
for(var jsonObject in body['items']) {
jsonObject.asset.assetNumber = jsonObject.assetNumber;
body.items[jsonObject] = jsonObject;
}
res.send(response.statusCode, body);
}
};
var optionsList={uri: '/mobile/platform/database/objects/ServiceRequest'};
req.oracleMobile.rest.get(optionsList,handler);
});
I am getting the same response and not the altered one. What am I missing here?
Thanks,
Gurkeerat Singh