我有两个几乎相同(但不完全)的json类型。我如何将它们转换为共同的POJO?我还要验证检查天气与给定的json匹配我的两个结构中的任何结构。
Pojo需要以下内容:
Json1:图片
{
"data": {
"id": "1463702032229439702_1213175392",
"user": {
"id": "1213175392",
"full_name": "Shubh Patel",
"profile_picture": "8479268741375_3699247309045891072_a.jpg",
"username": "imshubhpatel"
},
"images": {
"thumbnail": {
"width": 150,
"height": 150,
"url": "16906688_1657380991225027_6267811870028070912_n.jpg"
},
"low_resolution": {
"width": 320,
"height": 320,
"url": "7380991225027_6267811870028070912_n.jpg"
},
"standard_resolution": {
"width": 640,
"height": 640,
"url": "991225027_6267811870028070912_n.jpg"
}
},
"created_time": "1488706901",
"caption": {
"id": "17862995743119798",
"text": "#free #sunday #friends\n\ud83d\udcf7#galaxyS7edge #filter",
"created_time": "1488706901",
"from": {
"id": "1213175392",
"full_name": "Shubh Patel",
"profile_picture": "375_3699247309045891072_a.jpg",
"username": "imshubhpatel"
}
},
"user_has_liked": true,
"likes": {
"count": 69
},
"tags": [
"galaxys7edge",
"filter",
"friends",
"sunday",
"free"
],
"filter": "Lo-fi",
"comments": {
"count": 1
},
"type": "image",
"link": "m/p/BRQHT5IDZjW/",
"location": {
"latitude": 23.0269676032,
"longitude": 72.6177998974,
"name": "Amadavad, Gujarat, India",
"id": 323843626
},
"attribution": null,
"users_in_photo": [
]
},
"meta": {
"code": 200
}
}
Json 2:视频
{"data":{
"id":"1446990997590161365_3528222307",
"user":{
"id":"3528222307",
"full_name":"Quotes",
"profile_picture":"https://scontent.cdninstagram.com/t51.2885-19/s150x150/13636186_1007201962683005_401121573_a.jpg",
"username":"paper_quote"
},
"images":{
"thumbnail":{
"width":150,
"height":150,
"url":"https://scontent.cdninstagram.com/t51.2885-15/s150x150/e15/16464045_378045945896668_5822871099456618496_n.jpg"
},
"low_resolution":{
"width":320,
"height":320,
"url":"https://scontent.cdninstagram.com/t51.2885-15/s320x320/e15/16464045_378045945896668_5822871099456618496_n.jpg"
},
"standard_resolution":{
"width":612,
"height":612,
"url":"https://scontent.cdninstagram.com/t51.2885-15/e15/16464045_378045945896668_5822871099456618496_n.jpg"
}
},
"created_time":"1486714790",
"caption":{
"id":"17861817805113444",
"text":"#writer #when #a #man #loves #you",
"created_time":"1486714790",
"from":{
"id":"3528222307",
"full_name":"Quotes",
"profile_picture":"https://scontent.cdninstagram.com/t51.2885-19/s150x150/13636186_1007201962683005_401121573_a.jpg",
"username":"paper_quote"
}
},
"user_has_liked":false,
"likes":{
"count":8
},
"tags":[
"loves",
"a",
"when",
"you",
"writer",
"man"
],
"filter":"Clarendon",
"comments":{
"count":0
},
"type":"video",
"link":"https://www.instagram.com/p/BQUvqVUjLfV/",
"location":null,
"attribution":null,
"users_in_photo":[
],
"videos":{
"standard_resolution":{
"width":480,
"height":480,
"url":"https://scontent.cdninstagram.com/t50.2886-16/16551387_391810901170749_7519844898950873088_n.mp4"
},
"low_bandwidth":{
"width":480,
"height":480,
"url":"https://scontent.cdninstagram.com/t50.2886-16/16551387_391810901170749_7519844898950873088_n.mp4"
},
"low_resolution":{
"width":480,
"height":480,
"url":"https://scontent.cdninstagram.com/t50.2886-16/16551387_391810901170749_7519844898950873088_n.mp4"
}
}},"meta":{
"code":200}}