Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
gson sample (JSON -> model)
public interface JsonModel {
// model
}
public class JsonUtil {
@SuppressWarnings("unchecked")
public static <T> T fromJson(String jsonText, Class<? extends JsonModel> T) {
Gson gson = new Gson();
return (T) gson.fromJson(jsonText, T);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.