我有以下 JSON 数据:
{
"events":
{
"event":
[
{
"city":"Birmingham",
"state":"AL",
"country":"US",
"lat":"33.5206608",
"lng":"-86.80249",
"status":"Delivered",
"occured_at":"2012-04-06
14:17:00 UTC"
},
{
"city":"Birmingham",
"state":"AL",
"country":"US",
"lat":"33.5206608",
"lng":"-86.80249",
"status":"Out
For Delivery",
"occured_at":"2012-04-06 04:44:00 UTC"
},
{
"city":"Birmingham",
"state":"AL",
"country":"US",
"lat":"33.5206608",
"lng":"-86.80249",
"status":"Arrival
Scan",
"occured_at":"2012-04-05 19:07:00 UTC"
},
{
"city":"Doraville",
"state":"GA",
"country":"US",
"lat":"33.8981579",
"lng":"-84.2832564",
"status":"Departure
Scan",
"occured_at":"2012-04-05 17:08:00 UTC"
},
{
"city":"Doraville",
"state":"GA",
"country":"US",
"lat":"33.8981579",
"lng":"-84.2832564",
"status":"Arrival
Scan",
"occured_at":"2012-04-05 11:15:00 UTC"
},
{
"city":"Spartanburg",
"state":"SC",
"country":"US",
"lat":"34.9495672",
"lng":"-81.9320482",
"status":"Departure
Scan",
"occured_at":"2012-04-05 08:42:00 UTC"
},
{
"city":"Spartanburg",
"state":"SC",
"country":"US",
"lat":"34.9495672",
"lng":"-81.9320482",
"status":"Arrival
Scan",
"occured_at":"2012-04-05 08:21:00 UTC"
},
{
"city":"Greensboro",
"state":"NC",
"country":"US",
"lat":"36.0726354",
"lng":"-79.7919754",
"status":"Departure
Scan",
"occured_at":"2012-04-05 04:45:00 UTC"
},
{
"city":"Greensboro",
"state":"NC",
"country":"US",
"lat":"36.0726354",
"lng":"-79.7919754",
"status":"Origin
Scan",
"occured_at":"2012-04-05 00:11:00 UTC"
},
{
"city":null,
"state":null,
"country":"US",
"status":"Billing
Information Received",
"occured_at":"2012-04-04 18:20:27 UTC"
}
]
}
}
我需要做的是按城市、州和国家的组合对数据进行分组,但仍然返回每个项目的数据。
因此,例如,按“伯明翰,阿拉巴马州,美国”分组,但仍然能够用它来遍历status
每个事件(即已交付、外送、到达扫描)。