Reestruturando um JSON
OK pessoal precisam de ajuda lá fora. Ainda estou aprendendo Javascript e suas interações JSON. Eu tenho um JSON como este
[{
"categories":"Food",
"subcategories":"Shares",
"pid":"111",
"title":"Smoked Salmon Dip",
"description":"Rich and savory salmon dip, whipped with fresh dill accompanied with croustades"
},
{
"categories":"Food",
"subcategories":"Shares",
"pid":"112",
"title":"Sweet Goat Cheese Flatbread",
"description":"Delicate grilled Naan flatbread coated with delish tomato jam and topped with melted goat cheese, roasted garlic, fennel, onion, pear, shiitake mushroom and arugula."
},
{
"categories":"Food",
"subcategories":"Snacks",
"pid":"100",
"title":"Beer Chili",
"description":"Hot & satisfying short rib chili with black beans, smoked jalapenos, and fresh corn. Topped with aged cheddar cheese and sour cream."
}];
Mas o que eu preciso é de um JSON que se parece com isso
{
"menu":{
"categories":[
{
"name":"Food",
"subcategories":[
{
"name":"Shares",
"items":[
{
"pid":"111",
"title":"Smoked Salmon Dip",
"description":"Rich and savory salmon dip, whipped with fresh dill accompanied with croustades"
},
{
"pid":"112",
"title":"Sweet Goat Cheese Flatbread",
"description":"Delicate grilled Naan flatbread coated with delish tomato jam and topped with melted goat cheese, roasted garlic, fennel, onion, pear, shiitake mushroom and arugula."
}
]
},
{
"name":"Snacks",
"items":[
{
"pid":"100",
"title":"Beer Chili",
"description":"Hot & satisfying short rib chili with black beans, smoked jalapenos, and fresh corn. Topped with aged cheddar cheese and sour cream."
}
]
}
]
}]
}
}
Eu sei que é um pouco feio e, mas estou tendo problemas para descobrir como criar o novo JSON à medida que itero no meu atual.
Qualquer ajuda para me ajudar seria incrível