字符串转换


public static void main(String[] args) throws JsonProcessingException {
String resStr = "[{billType=idCard, filePath=IMG003:/data/upload/2020/7/28/00/xxxxxxxxxxxxxxxxx/a_7.jpg}, {billType=autoCard, filePath=IMG003:/data/upload/2020/7/28/00/xxxxxxxxxxxxxxxxx/b_7.jpg}, {billType=autoCard, filePath=IMG003:/data/upload/2020/7/28/00/xxxxxxxxxxxxxxxxx/c_7.jpg}]";
String s = resStr.replaceAll("\\s*", "")
.replaceAll("\\{", "\\{\"")
.replaceAll("=", "\":\"")
.replaceAll("}", "\"\\}")
.replaceAll(",", "\",\"")
.replaceAll("}\",\"\\{", "\\},\\{");
List<ImageVo> imageVos = JSONUtil.toList(JSONUtil.parseArray(s), ImageVo.class);
System.out.println(imageVos);
}
posted @ 2020-07-28 19:10  孤独的根号er  阅读(94)  评论(0编辑  收藏  举报