Guest User

Untitled

a guest
Jul 17th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. package greensyntax.in.co.fragmentviewsample;
  2.  
  3. import com.google.gson.Gson;
  4.  
  5. public class JSONParser {
  6.  
  7. private static Gson gson = new Gson();
  8.  
  9. // Parse Obj => JSON String
  10. public <T extends Object> String inJSON(T obj) {
  11. return gson.toJson(obj);
  12. }
  13.  
  14. public <T extends Object, E extends Class<T>> T inObjects(String jsonString, E className) {
  15. return gson.fromJson(jsonString, className);
  16. }
  17.  
  18. }
Add Comment
Please, Sign In to add comment