标签:
fastJson
下载地址:
https://github.com/alibaba/fastjson/
fastjson入口类是com.alibaba.fastjson.JSON,主要的API是JSON.toJSONString,和parseObject。
package com.alibaba.fastjson;
public abstract class JSON {
public static final String toJSONString(Object object);
public static final <T> T parseObject(String text, Class<T> clazz, Feature... features);
}
序列化:
String jsonString = JSON.toJSONString(obj);
反序列化:
VO vo = JSON.parseObject("...", VO.class);
泛型反序列化:
import com.alibaba.fastjson.TypeReference;
List<VO> list = JSON.parseObject("...", new TypeReference<List<VO>>() {});
标签:
原文地址:http://www.cnblogs.com/handsome1013/p/5305471.html