1:
fastjson:
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.33</version>
</dependency>
json字符串 转 带泛型的对象:
A<B> orderData = JSON.parseObject("json字符串",new TypeReference<A<B>>(){});
...
A<B<C>> orderData = JSON.parseObject("json字符串",new TypeReference<A<B<C>>>(){});
...
2:
直接使用 JSONObject,JSONArray处理
3:
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.1</version>
</dependency>
Gson gson = new Gson();
T t= gson.fromJson("jsonString", Class<T> clazz);