Skip to content

Instantly share code, notes, and snippets.

@jakewilson801
Created December 15, 2013 04:58
Show Gist options
  • Save jakewilson801/7969095 to your computer and use it in GitHub Desktop.
Save jakewilson801/7969095 to your computer and use it in GitHub Desktop.
How to parse json using GSON
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