我想从这些表创建一个JSON输出,如下所示:
我正在尝试从两个相关的MySQL表构建一个json输出。我有一个“餐厅”表和“盘子”表,“餐厅”表中的每个项目在“盘子”表中都有几个由ID引用的相关项目。每个餐厅项目ID都是Dishes表中的外键,为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"
}
],
}
]
}