com.neko233.skilltree.commons.json.JsonUtils233 Maven / Gradle / Ivy
package com.neko233.skilltree.commons.json;
import com.neko233.json.Json233;
import com.neko233.json.convert.PrettyJsonConfig;
import java.util.List;
public class JsonUtils233 {
/**
* json String
*
* @param obj 对象
* @return json string
*/
public static String toJsonString(Object obj) {
return Json233.serialize(obj);
}
public static String toJsonStringPretty(Object obj) {
return Json233.serialize(obj, PrettyJsonConfig.instance);
}
public static T parseToObject(String text,
Class clazz) throws Exception {
return Json233.deserialize(text, clazz);
}
public static List parseToObjectList(String text,
Class objClass) throws Exception {
return Json233.deserializeArray(text, objClass);
}
}