com.github.houbbbbb.sso.util.GsonUtil Maven / Gradle / Ivy
The newest version!
package com.github.houbbbbb.sso.util;
import com.google.gson.Gson;
/**
* @author : hbw
* @desctiption :
* @date : 2020-05-22 18:39
*/
public class GsonUtil {
private GsonUtil() {}
private static final Gson gson = new Gson();
public static String toJson(Object o){
return gson.toJson(o);
}
public static T toObj(String json, Class clazz){
if(null!=json) {
return gson.fromJson(json, clazz);
}
return null;
}
}