1
我有一個JSON數組,看起來像:合併JSON陣列
{
"error": false,
"service_prov_services": [
{
"service_measure": "Darmkrebsfrüherkennung (Schnelltest, Koloskopie)",
"service_prov_type": "Doctor",
"service_type": "Früherkennung und Vorsorge",
"service_prov_name": "Dr. Test",
"addr_street": "xxx Street"
},
{
"service_measure": "Gesundheits-Check-up",
"service_prov_type": "Doctor",
"service_type": "Früherkennung und Vorsorge",
"service_prov_name": "Dr. Test",
"addr_street": "xxx Street"
},
{
"service_measure": "Suchtmittelkonsum",
"service_prov_type": "Doctor",
"service_type": "Gesundheitskurse",
"service_prov_name": "Dr. Test",
"addr_street": "xxx Street"
},
{
"service_measure": "Stressbewältigung oder Entspannung",
"service_prov_type": "Doctor",
"service_type": "Gesundheitskurse",
"service_prov_name": "Dr. Test",
"addr_street": "xxx Street"
},
{
"service_measure": "Schutzimpfung",
"service_prov_type": "Doctor",
"service_type": "Sport und Gesundheit",
"service_prov_name": "Dr. Test",
"addr_street": "xxx Street"
}
]
}
我想它是在以下格式的JSON數組。 應該提取循環鍵值,並且只應發送一次。
{
"error": false,
"service_prov_type": "Doctor",
"service_prov_name": "Dr. Test",
"addr_street": "xxx Street",
"service_prov_services": [
{
"service_type": "Früherkennung und Vorsorge",
"service_measure": "Darmkrebsfrüherkennung
(Schnelltest, Koloskopie)","Gesundheits-
Check-up"
},
{
"service_type": "Gesundheitskurse",
"service_measure": "Suchtmittelkonsum",
"Stressbewältigung oder Entspannung"
},
{
"service_type": "Sport und Gesundheit",
"service_measure": "Schutzimpfung",
}
]
}
任何人都可以指出如何做到這一點? 我能夠使用usort對數組進行排序,但似乎無法提取循環密鑰。
請出示你已經嘗試了什麼至今 –
我不知道如何給它PHP.That排序。這就是爲什麼我問這裏是否有人可以點我在正確的方向 – Stefan