使用quill,获得一连串的json数据,需要遍历,将image中的url路径去掉,换成图片名称,个人记录,遍历如下:
JSONArray taskContentArr = taskContentObj.getJSONArray("ops"); for(int i=0;i<taskContentArr.size();i++){ // 遍历 jsonarray 数组,把每一个对象转成 json 对象JSONObject insertObj = taskContentArr.getJSONObject(i); try {JSONObject imageObj = insertObj.getJSONObject("insert");if (imageObj.containsKey("image")) {String imagePath = imageObj.getString("image");String fileName = imagePath.substring(imagePath.lastIndexOf("/") + 1);imageObj.put("image", fileName);}} catch (Exception e) {}}