io.github.kits.json.support.FastJsonSupport Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of whimthen-kits Show documentation
Show all versions of whimthen-kits Show documentation
Easy to use java tool library.
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;
}
}