1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
package com.zteits.wxcp.utils; import com.google.gson.Gson; import com.google.gson.GsonBuilder; /** * @author Binary Wang(https://github.com/binarywang) */ public class JsonUtils { public static String toJson(Object obj) { Gson gson = new GsonBuilder() .setPrettyPrinting() .create(); return gson.toJson(obj); } }