I want to construct an object array with key-value pair from a string array.
the string array format:
['<ISO Date> - <Log Level> - {"transactionId: "<UUID>", "details": "<message event/action description>", "err": "<Optionall, error description>"}']
the object array format:
[{"timestamp": <Epoch Unix Timestamp>, "loglevel": "<loglevel>", "transactionId: "<UUID>", "err": "<Error message>" }]
stringArray = [
"2021-08-09T02:12:51.259Z - error - {"transactionId":"9abc55b2-807b-4361-9dbe-aa88b1b2e978","details":"Cannot find user orders list","code": 404,"err":"Not found"}",
"2022-08-09T02:12:51.275Z - error - {"transactionId":"9abc55b2-807b-4361-9dbe-aa88b1b2e978","details":"Cannot find user orders list","code":404,"err":"Cannot find user orders list"}"
];
objectArray = [
{
"timestamp":1628475171259,
"loglevel":"error",
"transactionId":"9abc55b2-807b-4361-9dbe-aa88b1b2e978",
"err":"Not found"
},
{
"timestamp":1660011171275,
"loglevel":"error",
"transactionId":"9abc55b2-807b-4361-9dbe-aa88b1b2e97",
"err":"Cannot find user orders list"
}
];