There is a nested json array that needs to be flattened and key values (onSale, newComing) removed. Below are two JSON structures: the original and what is desired. Tools being used include Javascript-lodash-deepdash.
Original JSON:
[
{
"id": 1,
"model": "Google Pixel 3",
"image": "/src/assets/images/high-angle-app-learning-new-language-phone_23-2148293463.jpg",
"path": "/src/assets/images/high-angle-app-learning-new-language-phone_23-2148293463.jpg",
"price": 799,
"quantity": 2
},
...
]
Desired JSON:
[
{
"id": 1,
"model": "Google Pixel 3",
"image": "/src/assets/images/high-angle-app-learning-new-language-phone_23-2148293463.jpg",
"path": "/src/assets/images/high-angle-app-learning-new-language-phone_23-2148293463.jpg",
"price": 799,
"quantity": 2
},
...
]
Attempts with _.reduce and _.flatmap have been unsuccessful. Assistance is appreciated.