fastjson 常用汇总

fastjson

  • GitHub:https://github.com/alibaba/fastjson
  • 文档:https://github.com/alibaba/fastjson/wiki/Quick-Start-CN

依赖引入

<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>fastjson</artifactId>
    <version>1.2.76</version>
</dependency>

JSONArray 转换

List 转 JSONArray

JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(metaInfoFeatures));

字符串转对象

List<Info> infos = JSONArray.parseArray(content, Info.class);