I am trying to create a nested JSON that has data from various db tables and return it using format.json {render json: @Model}
For example a json structure like this:
{"Model1": [
{"id": 3, "name": "newURI", {"Model2": ["id": 4, "name":"vill"]}},
{"id": 1, "name": "bill", {"Model2": ["id": 1, "name":"lily"]}},
{"id": 2, "name": "ton", {"Model2": ["id": 2, "name":"bow"]}},
]}
I have searched around, but wasn't too successful. I saw Rabl, but the nested JSON generated is not well formed. Please help me if you can. Thanks