I would like to create a JSON output from those to tables to look like this:
I am trying to build a json output from two related MySQL tables. I have a table of "Restaurants" and table "Dishes" each item in Restaurants table has several relative items in the Dishes table which are referenced by id. Each Restaurant item ID is a foreign key in the Dishes table as f_id.
{
"Restaurants": [
{
"name": "String content",
"misc info": "String content"
"Dishes": [
{
"dish": "String content",
"description": "String content"
},
{
"dish": "String content",
"description": "String content"
}
],
},
{
"name": "String content",
"misc info": "String content"
"Dishes": [
{
"dish": "String content",
"description": "String content"
},
{
"dish": "String content",
"description": "String content"
}
],
}
]
}