I have a JSON generated by Papa Parse from a CSV file that look like this:
{ object, object, object, .... , object }
I need to modify it so it looks like this:
{ "publication" :
{
"id" : 1,
"name" : "name1"
},
"publication" :
{
"id" : 2,
"name" : "name2"
},
"publication" :
{
"id" : 3,
"name" : "name3"
}
}
Where the "id" and "name" are properties within each object.
In other words, I need a JSON that say "publication" and each "publication" occurrence have nested under it the properties names and values of one of the objects above.
How could I achieve this with Javascript?
Thanks