1. Introduce dependencies and guide packages
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.46</version>
</dependency>
import com.alibaba.fastjson.JSON;
2. At the beginning, use the following method to convert, but the operation error
lockVoObj is an object object
List<RoomQueueInfoVo> list= JSON.parseArray(JSON.toJSONString(lockVoObj), RoomQueueInfoVo.class);
This conversion will report the following exception:
Resolved [com.alibaba.fastjson.JSONException: exepct '[', but string, pos
Three. Solution
`String object_str = JSON.toJSON(object).toString();//2020 10/28
List<RoomQueueInfoVo> list= JSON.parseArray(object_str, RoomQueueInfoVo.class);`