导包:

import org.json.JSONObject;

1.对象转string

String string = JSONObject.toJSONString(T);

2.string转对象

T t = JSONObject.parseObject(pojo, T.tclass);

3.Lits转String

String jsons = JSON.toJSONString(tList);

4.String 转list

List<T> list = JSONArray.parseArray(string, T.class);

5.String转json

JSONObject jsonObject = JSON.parseObject(string);

版权声明:本文为supiaopiao原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/supiaopiao/p/13050349.html