I am trying to transform an array of objects structure from looking like this:
[
{
id: 1,
val: "bool",
name: "somename",
entities: [
{
id: 1,
name: "varchar",
type: "string"
}
]
},
{
id: 2,
val: "bool",
name: "somename",
entities: [
{
id: 1,
name: "varchar",
type: "string"
}
]
}
]
Into this:
[
{
id: 1,
val: "bool",
name: "somename",
entitiesName: "varchar",
entitiesType: "string"
},
{
id: 2,
val: "bool",
name: "somename",
entitiesName: "varchar",
entitiesType: "string"
}
]
So more or less I want to take two values from entities and make them into key/values in the root object instead.
I have tried using Object.entries(data).map() but I am stuck