Here's an API response that I would like to parse to create later an array:
{
"@odata.context": "https://online.wonderware.eu/apis/mes/odata/$metadata#UtilizationEvents",
"value": [
{
"StartTime": "2021-06-04T09:50:34.364Z",
"AssetId": "82eb3e43-725d-4a83-979e-9e6ac27c51c1",
"Equipment": "Capper 1",
"Namespace": "Austin",
"Location": "Texas/Austin Plant/Pack Area",
"StateType": 2,
"EquipmentState": "RUNNING",
"UtilizationReason": "Running",
"Comment": "",
"Duration": 307904,
"AutomationSource": null,
"Color": "#009848",
"Id": "85403cb7-84b3-46b2-8637-73f444f3c3b2",
"LastModified": "2021-06-04T09:55:42.3658373Z",
"_etag": "\"3600708b-0000-0c00-0000-60b9f89e0000\""
},
{
"StartTime": "2021-06-04T09:55:42.268Z",
"AssetId": "82eb3e43-725d-4a83-979e-9e6ac27c51c1",
"Equipment": "Capper 1",
"Namespace": "Austin",
"Location": "Texas/Austin Plant/Pack Area",
"StateType": 3,
"EquipmentState": "UNPLANNED DT",
"UtilizationReason": "Equipment Failure",
"Comment": "",
"Duration": 22748,
"AutomationSource": null,
"Color": "#DC0A0A",
"Id": "61f8703f-e8b2-409e-8784-6566dfd8c2cd",
"LastModified": "2021-06-04T09:56:05.1169671Z",
"_etag": "\"3600a590-0000-0c00-0000-60b9f8b50000\""
},
{
"StartTime": "2021-06-04T09:56:05.016Z",
"AssetId": "82eb3e43-725d-4a83-979e-9e6ac27c51c1",
"Equipment": "Capper 1",
"Namespace": "Austin",
"Location": "Texas/Austin Plant/Pack Area",
"StateType": 3,
"EquipmentState": "UNPLANNED DT",
"UtilizationReason": "E Stop",
"Comment": "",
"Duration": 254974517,
"AutomationSource": null,
"Color": "#DC0A0A",
"Id": "2ea162e3-5c1b-434f-ba89-aeb9018f227c",
"LastModified": "2021-06-04T09:56:05.1409672Z",
"_etag": "\"3600a690-0000-0c00-0000-60b9f8b50000\""
}
]
}
Then I need to create an array for each object (in the example above there are 3) considering the following keys ('state' is a fixed text for all arrays):
Example:
['state', 'UtilizationReason', StartTime, LastModified]
-> so will be =
[State, Running, 2021-06-04T09:50:34.364Z, 2021-06-04T09:55:42.3658373Z]
Then create a new array with the same information considering the second object, and so on.
The above response query it's just an example, it can be much more bigger. How should I manage it to success? I'm very new with JavaScript.