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

io.github.kits.json.support.FastJsonSupport Maven / Gradle / Ivy

The newest version!
package io.github.kits.json.support;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import io.github.kits.interfaces.JsonSupport;

import java.util.List;

/**
 * @project: kits
 * @created: with IDEA
 * @author: nzlong
 * @date: 2019 01 24 09:59 | January. Thursday
 */
public class FastJsonSupport implements JsonSupport {

    @Override
    public String toJson(Object object) {
        return JSON.toJSON(object).toString();
    }

    @Override
    public T toObject(String jsonStr, Class clazz) {
        return JSON.parseObject(jsonStr, clazz);
    }

    @Override
    public List toList(String jsonStr, Class clazz) {
        return JSONArray.parseArray(jsonStr, clazz);
    }

    @Override
    public String prettyJson(Object object) {
        return null;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy