Hello I'm stuck transforming this object to an object array.
There are the number and reason field, which are currently an ',' separated string. They should be exploded into their own object. The exampel dataset and what I want to archive can be seen in the codesnippet below.
// start value
const data = {
date: "2021-09-07 10:28:34,2021-09-08 14:45:22",
startDate: "2021-09-07 00:00:00,2021-09-08 14:45:22"
id: "111111"
number: "1,9"
reason: "Autres,Autres"
}
// what I want to archive:
const res = [{
date: "2021-09-07 10:28:34",
startDate: "2021-09-07 00:00:00",
id: 11111,
number: 1,
reason: "Autres"
} {
date: "2021-09-08 14:45:22",
startDate: "2021-09-08 14:45:22",
id: 11111,
number: 9,
reason: "Autres"
}]
.split()combined with some loops should already get you into the right direction.