I have a json response look like this
"pen": [
{
"company": "Lexi",
"ink": "red",
"instock": true
},
{
"company": "Lexi",
"ink": "blue",
"instock": true
}
]
But I want it in this way
"pen": [
{
"company": "Lexi",
"items":[
{
"ink": "red",
"instock": true
}
{
"ink": "blue",
"instock": true
}
]
}
]
I have the POJO of the first json response.The second one holds the items with the same company name.How can I convert it to the second one?.