Check if output in the Object of arrays (steps) has 'error' and display the message in the 'error' along with the particular id.
I want to display the error if exists in JavaScript.
Here is the JSON,
{
"steps": [
{
"start": null,
"stop": null,
"status": "PENDING",
"input": null,
"output": null,
"id": "45968631-4b24-4b80-a618-954ec383ce8d"
},
{
"start": "2019-08-23T00:11:27.323325Z",
"stop": "2019-08-23T00:11:50.581740Z",
"status": "SUCCESS",
"input": {
"url": "https://www.google.com"
},
"output": {
"filepath": "/tmp/filepath"
},
"id": "153eec8e-aff0-4566-9dee-bd2235f59886"
},
{
"start": "2019-08-23T00:26:31.377313Z",
"stop": "2019-08-23T00:26:58.489024Z",
"status": "SUCCESS",
"input": null,
"output": {
"url": "url"
},
"id": "cb2280a8-3b75-4e7b-9052-42a563b4fd9e"
},
{
"start": "2019-08-23T00:41:00.988154Z",
"stop": "2019-08-23T00:41:04.528278Z",
"status": "SUCCESS",
"input": {
"key": "userKey"
},
"output": {
"error": "ProcessorError"
},
"id": "65324ed2-d347-4a35-8fdc-fe11b98d5e70"
}
]
}
There are some places, where Output does not have 'error' and some it has null.