I'm currently working on creating a loop in JavaScript or jQuery to generate a new JSON object from an array. The goal is to convert an input JavaScript array into a desired format for the output. Here's the input array:
INPUT:
[
{
"parent": "parent_1",
"child": "abc",
"data": "data1"
},
...
From the above array, I need a loop that will produce the following JSON object structure:
OUTPUT:
[
{
"parent_1": {
"child": [
{
"name": "abc",
"data": "data1"
},
...
]
}
},
...
]