java - How to parse data from a json list by using Gson? -
now json file data in format:
[ [ "name1", "age1", "gender1", url1 ], [ "name2", "age2", "gender2", url2 ], ... ]
now want parse , store them in database using gson, don't know how write code it.
the list may contains 200,000 small lists, don't know if take lot of memory if use gson.fromjson() whole json list. there dynamic method parse each small list in it?
gson 2.1 introduced new typeadapter interface permits mixed tree , streaming serialization , deserialization. api efficient , flexible. see gson's streaming doc example of combining tree , binding modes. strictly better mixed streaming , tree modes; binding don't waste memory building intermediate representation of values. gson has apis recursively skip unwanted value; gson calls skipvalue().
source: java - best approach parse huge (extra large) json file jesse wilson
Comments
Post a Comment