I want to convert this json object that contain string value separated by comma to array:
[
{id: 1,
name: 'book',
colors: 'red, yellow, blue'
},
id: 2,
name: 'book',
colors: 'red, yellow, blue'
}
]
to:
[
{id: 1,
name: 'book',
colors: ['red', 'yellow', 'blue']
},
id: 2,
name: 'book',
colors: ['red', 'yellow', 'blue']
}
]
in javascript, thank you!