All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.neko233.skilltree.commons.json.JsonUtils233 Maven / Gradle / Ivy

There is a newer version: 0.3.6
Show newest version
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);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy