所以直奔主题。我有一个问题,我从 api 获取数据作为对象数组。每个对象包括一个城市和一个区。城市和地区是包含名称和 ID 的对象
city: Object
id: 3
name: "Rathbury"
district: Object
id: 39
name: "Bosnia and Herzegovina District"
更新: 输入
[
{
"title": "Kris Lodge",
"location_text": "5739 Jakob Prairie Suite 451\nWest Leraview, MI 35816",
"latitude": "",
"longitude": "",
"phone_numbers": [
"01648997890",
"01038129111"
],
"emails": [
"christy.spinka@example.com",
"yboyle@example.org"
],
"city": {
"id": 9,
"name": "Bernhardburgh"
},
"district": {
"id": 13,
"name": "Hong Kong Neighbourhood"
}
},
{
"title": "Tanner Circles",
"location_text": "4513 Patrick Junctions\nNorth Priceport, CT 05572-1565",
"latitude": "",
"longitude": "",
"phone_numbers": [
"01894655129",
"01768939354",
"01054035727",
"01120801876"
],
"emails": [
"francisca56@example.org",
"lloyd.hilpert@example.com",
"aaliyah.rau@example.net"
],
"city": {
"id": 3,
"name": "Rathbury"
},
"district": {
"id": 11,
"name": "Vanuatu Neighbourhood"
}
},
{
"title": "Walsh Harbors",
"location_text": "5300 McGlynn Flat\nGustaveville, PA 08941-6431",
"latitude": "",
"longitude": "",
"phone_numbers": [
"01330125574"
],
"emails": [
"qgreenholt@example.org",
"isawayn@example.net",
"jtillman@example.com"
],
"city": {
"id": 15,
"name": "Wintheiserfort"
},
"district": {
"id": 34,
"name": "Armenia Neighbourhood"
}
},
{
"title": "Botsford Villages",
"location_text": "461 Zemlak Hollow Suite 549\nLangworthberg, NE 40867-0943",
"latitude": "",
"longitude": "",
"phone_numbers": [
"01955713451",
"01819751112",
"01366897031"
],
一个城市可以出现两次,但一个地区不能出现。如何只列出城市内的地区一次?这是显示更多详细信息的图像。我怎样才能得到展示Mali Area和Bosnia and Herzegovina District下Amparoville一次?

翻过高山走不出你
慕少森
随时随地看视频慕课网APP
相关分类