Web API will return JSON automatically, but what if I want it in a different layout. For example, if Web API returns,
[
{
"patron": 9,
"last_name": "Smith",
"book": {
"book_id": 1,
"patron": 9
}
},
{
"patron": 9,
"last_name": "Smith",
"book": {
"book_id": 2,
"patron": 9
}
},
{
"patron": 9,
"last_name": "Smith",
"book": {
"book_id": 3,
"patron": 9
}
}
]
but I want,
[
{
"patron": 9,
"last_name": "Smith",
"books": [
{
"book_id": 1,
"patron": 9
},
{
"book_id": 2,
"patron": 9
},
{
"book_id": 3,
"patron": 9
}
]
}
]
Is there a way to do this without handwriting my JSON result? I really don't wan to do that.