I'm displaying data from my db in json format using rabl to parse it for android...
My json looks like so:
[
{
"bank":{
"central_office_address":"ololo",
"license":"12312312",
"location_id":3,
"name":"Pbank",
"tax_number":"12312312",
"year_of_foundation":1987
}
},
{
"bank":{
"central_office_address":"sdfsdf sdf",
"license":"321312",
"location_id":3,
"name":"Bbank",
"tax_number":"321321",
"year_of_foundation":1999
}
}
]
I need my json in a format like:
{
"contacts": [
{
"id": "c200",
"name": "Ravi Tamada",
"email": "
[email protected]",
"
address": "xx-xx-xxxx,x -
street, x - country",
"gender" : "male",
"phone": {
"mobile": "+91 0000000000",
"home": "00 000000",
"office": "00 000000"
}
},
{
"id": "c201",
"name": "Johnny Depp",
"email": "
[email protected]",
"
address": "xx-xx-xxxx,x -
street, x - country",
"gender" : "male",
"phone": {
"mobile": "+91 0000000000",
"home": "00 000000",
"office": "00 000000"
}
}
]
}
Such data is normally parsed in java....
My rabl view:
object @banks
attributes :central_office_address, :license, :location_id, :name, :tax_number, :year_of_foundation
How do I change its output to match the second example?