在java中,如何从java中的JSON对象中获取唯一location_id字段的maxRegistration和current_registration字段之和.我说sum是因为location_id可能在json中重复.我刚接触java a,这对我来说相当复杂.
[
{
"date": "2022-06-29",
"registrationDetails": {
"registration": {
"maxRegistration": 10,
"restriction": "perBooking"
}
},
"location_id": "1111",
"book_id": "abcd",
"current_registration": 4,
},
{
"date": "2022-06-29",
"registrationDetails": {
"registration": {
"maxRegistration": 15,
"restriction": "perBooking"
}
},
"location_id": "1111",
"book_id": "efgh",
"current_registration": 7,
},
{
"date": "2022-06-29",
"registrationDetails": {
"registration": {
"maxRegistration": 10,
"restriction": "perBooking"
}
},
"location_id": "3673",
"book_id": "1112",
"current_registration": 8,
}
]