Reputation: 642
Currently I am working with JSON parser. I read some blogs regarding other parsers like jackson and gson... but unaware of use of them and which one is fastest?
Upvotes: 0
Views: 181
Reputation: 1650
I had custom requrements for my apps, regarding JSON parsing, and after few itterations, i have developed my own library for JSON parsing/serializing/deserializing using Java generics.
All you need is model class, webservice url and Context. Feel free to check it on GitHub, it might be helpful.
Usage example:
new AsyncJsonProvider(getActivity(), Planet.class, "http://planetjsonurl.com").shortExecute(new OnDataLoaded() {
@Override
public void OnModelLoaded(Model responseModel) {
Planet p = (Planet) responseModel;
if (p != null) {
//your action after data fetching
}
}
});
Upvotes: 0
Reputation: 2048
Jackson Parser is the best parsor till now. Its very easy to use , you need to add .jar files for jackson parser in the libs .
Here are many tutorials that will help you to know the implementation .
http://www.journaldev.com/2324/jackson-json-processing-api-in-java-example-tutorial
http://wiki.fasterxml.com/JacksonInFiveMinutes
Upvotes: 1