Below is a json string that needs to be converted into a new Json Array:
Raw Data:
[
["yrxqBHmPkNhZ60_eab97ebf-c2a3-40a5-972a-91597ad9a4ca_99371", "SUCCEEDED", "2023-08-31T21:59:31.325000+05:30", "2023-08-31T22:13:42.165000+05:30"],
["yrxqBHmPkNhZ60_f42702be-16c3-44bf-bc3b-6719c740a5e3_98405", "SUCCEEDED", "2023-08-31T21:43:25.581000+05:30", "2023-08-31T21:57:47.681000+05:30"],
["rk9QMf81WrT7DO_edd6e8de-9de4-4885-b970-9311443d81d5_98750", "SUCCEEDED", "2023-08-31T21:49:10.578000+05:30", "2023-08-31T21:56:20.197000+05:30"]
]
The following code snippet has been used to convert the above data into the expected format:
var dataObj = JSON.parse(myStr); // where myStr represents the data string above
var newData = new Array();
for(var i in dataObj) {
newData.push(dataObj[i]);
}
data.push(newData);
Expected Result:
[
"type": "buffer",
"data":[
["yrxqBHmPkNhZ60_eab97ebf-c2a3-40a5-972a-91597ad9a4ca_99371", "SUCCEEDED", "2023-08-31T21:59:31.325000+05:30", "2023-08-31T22:13:42.165000+05:30"],
["yrxqBHmPkNhZ60_f42702be-16c3-44bf-bc3b-6719c740a5e3_98405", "SUCCEEDED", "2023-08-31T21:43:25.581000+05:30", "2023-08-31T21:57:47.681000+05:30"],
["rk9QMf81WrT7DO_edd6e8de-9de4-4885-b970-9311443d81d5_98750", "SUCCEEDED", "2023-08-31T21:49:10.578000+05:30", "2023-08-31T21:56:20.197000+05:30"]
]
]