I receive from a web service a list of json objects that may containing different keys. Eg one would have a title, a url and a list of picture urls, another one would have the same more a phone number... I need to keep these objects in memory but I'm not sure about the best way to do it.
1- I could keep the JSONObject as it is.
2- I could create an array of generic Item
object with all the possible fields (most are common to all items) and for each instance set only the fields which have the corresponding keys in the json object, and leave the others null.
3- I could also create for each object a map with the keys contained by the item.
Any thoughts about the best method?
Thanks
Jul
I would look at Jackson or GSON for JSON object mapping.
精彩评论