What are good practice for handling json over a Rest Framework in Android. For instance, if I get a certain json result as follow (or any other, I'm just giving something more complex):
{"lifts":
[{
"id":26,
"time":"2012-11-21T12:00:00Z",
"capacity":4,
"price":10,
"from": {
"description":null,
"city": {
"name":"Montreal"
}
},
"to":{
"description":"24 rue de la ville",
"city":{
"name":"Sherbrooke"
}
},
"driver":{
"first_name": "Benjamin",
"image":"https://graph.facebook.com/693607843/picture?type=large"
}
}
]}
1) Should I handle the result manually and get each value to populate my ui... (Not really)
2) Should I create a POJO for each object (to handle the mapping, with JSONObject). In my example, I will have to create a lift object that handle all the parameters and even create more POJO, to use for instance image and probably locations. (so basically, I constantly need to check my api rest framework to see how my object are done on server side, I'm duplicating my models from server to the android client).
3) Is there any framework to handle the mapping (serialize and deserialization).
I'm currently using option number 2, but was wondering if there was something better out there. It's working for me so far, for receiving and sending.