com.github.knightliao.apollo.utils.data.GsonUtils Maven / Gradle / Ivy
package com.github.knightliao.apollo.utils.data;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.Map;
/**
* Google Json工具
*
* @author liaoqiqi
* @version 2014-6-16
*/
public final class GsonUtils {
private GsonUtils() {
}
/**
* @param object
* @return
*/
public static String toJson(Object object) {
Gson gson = new Gson();
String json = gson.toJson(object);
return json;
}
/**
* Parse json to map
*
* @param json
* @return
*/
public static Map parse2Map(String json) {
Type stringStringMap = new TypeToken
© 2015 - 2025 Weber Informatics LLC | Privacy Policy