I'm getting JSON Input request as exactly as below and storing the request in one variable.
Example : var input_json = context.getVarible ("JSONInput")
the data inside JSONInput is as below
{
"line": 1,
"identifier": "12345",
"status_code": 422,
"message": "The Product Hierarchy attribute does not exist in your."
}
{
"line": 2,
"identifier": "121515",
"status_code": 201
}
Need to convert the above request to as below and need to pass in
{
"messages": [
{
"status": "failure",
"code": "422",
"message": "The Product Hierarchy attribute does not exist in your.",
},
{
"status": "success",
"code": "201",
"message": "JSON message received"
}
]
}
Need a javascript for this.