mySql 输出这个:
如您所见,第 3 行和第 4 行有重复项,因此我想在输出 Json 时合并这些重复项。确切地说,我希望我的 json 是这样的:
[
{
"name": "The Crane Bar",
"lat": "53.2692",
"lng": "-9.06151",
"events": [
{
"name": "Traditional music session",
"info": null
}
]
},
{
"name": "Taaffes Bar",
"lat": "53.2725",
"lng": "-9.05321",
"events": [
{
"name": "6 Nations, Italy VS Ireland",
"info": null
}
]
},
{
"name": "a house",
"lat": "37.4401",
"lng": "-122.143",
"events": [
{
"name": "Party at Palo Alto",
"info": "Some info about the party"
},
{
"name": "2gdfgdf",
"info": "2gdfgdfgdf"
}
]
}
]
您知道使用一个 location_name、lat 和 lng 并嵌套了 event_name 和 post_content(如这里的信息)。
谢谢!