Here is code:
var codeArray = code.split(','); // [AE00,AE21,BE00,CD00]
_this.abstractGetFrom(null, parser, path, params)
.then(function(response) {
codeArray.forEach(function(element) {
if (!(element in response.results.row)) {
response.results.push({'row':
{'CODE': element, 'HTML': 'N', 'CSS': 'N'}
});
}
});
return resolve(response);
}).catch(function(err) {
return reject(err);
});
Trying to achieve: when we send invalid CODE in request it is returning nothing
which I want to parse and put "{'CODE': element, 'HTML': 'N', 'CSS': 'N'}" instead blank
its third level object and search and inject object is required
Function abstractGetFrom //url?CODE&CODE&CODE ... is returning like following json.
{
"response": {
"metadata": [
{
"totalrawcount": 2
},{
"rendertime": 01
},{
"totalresponsetime": 55
}],
"results": [
{
"row": {
"CODE": "AE100",
"HTML": "N",
"CSS": "N"
}
},
{
"row": {
"CODE": "ABE10",
"HTML": "Y",
"CSS": "Y"
}
}
]
}
}
via user139856
No comments:
Post a Comment