java String字符串 [{"RQCount":"4","R_Model":"螺丝","SerialNum":"ZDW23072400599,OWOR,4M27-221-0000-0,1,,,,","R1":"1","R2":"1","R3":"1","R4":"1","R5":"-","L1":"1","ProdType":"4M27-221-0000-0","MoldNum":"10","L2":"1","L3":"1","L4":"1","LT1":"1","L5":"-","LT3":"1","OutputTime":"2023-07-24 16:16:56","LT2":"1","LT5":"-","LT4":"1","RT1":"1","WorkTime":"17","RT3":"1","L_Model":"螺丝","RT2":"1","RT5":"-","RT4":"1","LH1":"1","LH3":"1","LH2":"1","LH5":"-","LH4":"1","WaitMoveTime":"5.8","RH1":"1","LQCount":"4","RH3":"1","RH2":"1","RH5":"-","RH4":"1"},{"RQCount":"4","R_Model":"螺丝","SerialNum":"ZDW23072400600,OWOR,4M27-241-0000-0,1,,,,","R1":"1","R2":"1","R3":"1","R4":"1","R5":"-","L1":"1","ProdType":"4M27-241-0000-0","MoldNum":"12","L2":"1","L3":"1","L4":"1","LT1":"1","L5":"-","LT3":"1","OutputTime":"2023-07-24 16:17:26","LT2":"1","LT5":"-","LT4":"1","RT1":"1","WorkTime":"16","RT3":"1","L_Model":"螺丝","RT2":"1","RT5":"-","RT4":"1","LH1":"1","LH3":"1","LH2":"1","LH5":"-","LH4":"1","WaitMoveTime":"5.5","RH1":"1","LQCount":"4","RH3":"1","RH2":"1","RH5":"-","RH4":"1"}] 转换成List<List<Map<String,Object>>>
时间: 2023-07-30 16:13:16 浏览: 187
有关pgsql高级函数汇总
5星 · 资源好评率100%
要将该字符串转换为List<List<Map<String, Object>>>,您可以使用以下代码:
```java
import com.alibaba.fastjson.JSON;
import java.util.List;
import java.util.Map;
public class Main {
public static void main(String[] args) {
String jsonString = "[{\"RQCount\":\"4\",\"R_Model\":\"螺丝\",\"SerialNum\":\"ZDW23072400599,OWOR,4M27-221-0000-0,1,,,,\",\"R1\":\"1\",\"R2\":\"1\",\"R3\":\"1\",\"R4\":\"1\",\"R5\":\"-\",\"L1\":\"1\",\"ProdType\":\"4M27-221-0000-0\",\"MoldNum\":\"10\",\"L2\":\"1\",\"L3\":\"1\",\"L4\":\"1\",\"LT1\":\"1\",\"L5\":\"-\",\"LT3\":\"1\",\"OutputTime\":\"2023-07-24 16:16:56\",\"LT2\":\"1\",\"LT5\":\"-\",\"LT4\":\"1\",\"RT1\":\"1\",\"WorkTime\":\"17\",\"RT3\":\"1\",\"L_Model\":\"螺丝\",\"RT2\":\"1\",\"RT5\":\"-\",\"RT4\":\"1\",\"LH1\":\"1\",\"LH3\":\"1\",\"LH2\":\"1\",\"LH5\":\"-\",\"LH4\":\"1\",\"WaitMoveTime\":\"5.8\",\"RH1\":\"1\",\"LQCount\":\"4\",\"RH3\":\"1\",\"RH2\":\"1\",\"RH5\":\"-\",\"RH4\":\"1\"},{\"RQCount\":\"4\",\"R_Model\":\"螺丝\",\"SerialNum\":\"ZDW23072400600,OWOR,4M27-241-0000-0,1,,,,\",\"R1\":\"1\",\"R2\":\"1\",\"R3\":\"1\",\"R4\":\"1\",\"R5\":\"-\",\"L1\":\"1\",\"ProdType\":\"4M27-241-0000-0\",\"MoldNum\":\"12\",\"L2\":\"1\",\"L3\":\"1\",\"L4\":\"1\",\"LT1\":\"1\",\"L5\":\"-\",\"LT3\":\"1\",\"OutputTime\":\"2023-07-24 16:17:26\",\"LT2\":\"1\",\"LT5\":\"-\",\"LT4\":\"1\",\"RT1\":\"1\",\"WorkTime\":\"16\",\"RT3\":\"1\",\"L_Model\":\"螺丝\",\"RT2\":\"1\",\"RT5\":\"-\",\"RT4\":\"1\",\"LH1\":\"1\",\"LH3\":\"1\",\"LH2\":\"1\",\"LH5\":\"-\",\"LH4\":\"1\",\"WaitMoveTime\":\"5.5\",\"RH1\":\"1\",\"LQCount\":\"4\",\"RH3\":\"1\",\"RH2\":\"1\",\"RH5\":\"-\",\"RH4\":\"1\"}]";
List<List<Map<String, Object>>> list = JSON.parseObject(jsonString, List.class);
System.out.println(list);
}
}
```
这段代码使用了fastjson库将字符串解析为List<List<Map<String, Object>>>对象,并输出结果。请确保您已经导入fastjson库。
这样,您就可以将字符串转换为List<List<Map<String, Object>>>对象了。
阅读全文