I have array of objects.
let data = [
{
"categories" : [
{
"products" : [
{
"name" : "Product 1"
}
],
"id" : 1369
}
]
}
];
I'd like to rebuild it like this:
let data = [
{
"products" : [
{
"name" : "Product 1"
}
],
"id" : 1369
}
];
If I use .map(), I get array in array with object:
let data = [
[
{
"products" : [
{
"name" : "Product 1"
}
],
"id" : 1369
}
]
];
What the solution I must apply in this case?
data = data[0].categories