Created
December 15, 2013 04:58
-
-
Save jakewilson801/7969095 to your computer and use it in GitHub Desktop.
How to parse json using GSON
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Summary summaryData; | |
AsyncHttpClient client = new AsyncHttpClient(); | |
client.get("http://i.tv/getmesomesuperawesomedata", new AsyncHttpResponseHandler() { | |
@Override | |
public void onSuccess(String response) { | |
Type listType = new TypeToken<Summary>() {}.getType(); | |
summaryData = (Summary) new Gson().fromJson(response, listType); | |
//now summary data will be in memory from a json string | |
//no more traversing json objects to get the data we need this call does all that magic | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment