Looking to transform a data structure from an
array of objects containing objects
to an objects in array
setup using JavaScript/Typescript.
Input:
[
{
"a": "Content A",
"b":
{
"1": "Content 1",
"2": "Content 2"
}
},
{
"y": "Content Y",
"x":
{
"3": "Content 3",
"4": "Content 4"
}
},
]
Expected output
[
{a: "Content A", b: "Content 1"},
{a: "Content A", b: "Content 2"},
{y: "Content Y", x: "Content 3"},
{y: "Content Y", x: "Content 4"}
]
Providing solutions in both TypeScript and JavaScript would be greatly appreciated!