//data是数组[{"goodsId":"3","num":"1"},{"goodsId":"2","num":"1"}] JSONArray arrar = JSONArray.parseArray(data); for(int j=0;j<arrar.size();j++){ System.out.println(arrar.get(j).toString()); OrderInfo orderInfo = new OrderInfo(); JSONObject item = JSONObject.parseObject(arrar.get(j).toString()); Goods goods = goodsDao.findId(Integer.parseInt(item.getString("goodsId")));
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson --> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.58</version> </dependency>
站长微信:xiaomao0055
站长QQ:14496453