Cześć mam problem, w Spring Boocie, a w zasadzie wątpliwości co do przetwarzania dużych JSONów żeby wydobyć z nich informacje. Mam takiego JSONa i chce wydobyć z niego pola :
type, comments, standard_resolution( url, width, height), created_time, location. I zapakować TYLKO te informacje do swojego obiektu, a dokładniej ich listy.
W jaki sposób należało by to zrobić? Użyłem w swoim programie biblioteki Jackson i po kolei z po kluczu w pętli wybieram tylko te pola które mnie interesują. Jednak takie rozwiązanie generuje zbyt dużo kodu. Jakieś pomysły na lepsze rozwiązanie tego problemu ?
{
"data": [{
"type": "image",
"users_in_photo": [],
"filter": "Earlybird",
"tags": ["snow"],
"comments": {
"count": 3
},
"caption": {
"created_time": "1296703540",
"text": "#Snow",
"from": {
"username": "emohatch",
},
"id": "26589964"
},
"likes": {
"count": 1
},
"link": "http://instagr.am/p/BWl6P/",
"user": {
"username": "emohatch",
},
"created_time": "1296703536",
"images": {
"low_resolution": {
"url": "http://distillery.s3.amazonaws.com/media/2011/02/02/f9443f3443484c40b4792fa7c76214d5_6.jpg",
"width": 306,
"height": 306
},
"thumbnail": {
"url": "http://distillery.s3.amazonaws.com/media/2011/02/02/f9443f3443484c40b4792fa7c76214d5_5.jpg",
"width": 150,
"height": 150
},
"standard_resolution": {
"url": "http://distillery.s3.amazonaws.com/media/2011/02/02/f9443f3443484c40b4792fa7c76214d5_7.jpg",
"width": 612,
"height": 612
}
},
"id": "22699663",
"location": null
},
{
"type": "video",
"videos": {
"low_resolution": {
"url": "http://distilleryvesper9-13.ak.instagram.com/090d06dad9cd11e2aa0912313817975d_102.mp4",
"width": 480,
"height": 480
},
"standard_resolution": {
"url": "http://distilleryvesper9-13.ak.instagram.com/090d06dad9cd11e2aa0912313817975d_101.mp4",
"width": 640,
"height": 640
},
"users_in_photo": null,
"filter": "Vesper",
"tags": ["snow"],
"comments": {
"count": 2
},
"caption": {
"created_time": "1296703540",
"text": "#Snow",
"from": {
"username": "emohatch",
},
"id": "26589964"
},
"likes": {
"count": 1
},
"link": "http://instagr.am/p/D/",
"user": {
"username": "kevin",
},
"created_time": "1279340983",
"images": {
"low_resolution": {
"url": "http://distilleryimage2.ak.instagram.com/11f75f1cd9cc11e2a0fd22000aa8039a_6.jpg",
"width": 306,
"height": 306
},
"thumbnail": {
"url": "http://distilleryimage2.ak.instagram.com/11f75f1cd9cc11e2a0fd22000aa8039a_5.jpg",
"width": 150,
"height": 150
},
"standard_resolution": {
"url": "http://distilleryimage2.ak.instagram.com/11f75f1cd9cc11e2a0fd22000aa8039a_7.jpg",
"width": 612,
"height": 612
}
},
"id": "3",
"location": null
},
...]
}