Skip to content

Instantly share code, notes, and snippets.

@ctataryn
Last active August 29, 2015 13:57
Show Gist options
  • Save ctataryn/9671031 to your computer and use it in GitHub Desktop.
Save ctataryn/9671031 to your computer and use it in GitHub Desktop.
private <T> List<T> fromJson(String json, Class<T> clazz) {
Gson gson = new Gson();
Type absUserListType = new TypeToken<Collection<T>>() {
}.getType();
// convert the json string back to object
List<T> objs = gson.fromJson(json, absUserListType);
return objs;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment