java后台怎么解析含有特殊字符的json字符串,如含有逗号,冒号等特殊字符
{"s0":413,"m1":"sdfs,123,sdf,sdfsdf,sdfsdf","m2":"","m3":"","m4":"","m5":"摘要","m6":"豫...
{"s0":413,"m1":"sdfs,123,sdf,sdfsdf,sdfsdf","m2":"","m3":"","m4":"","m5":"摘要","m6":"豫检【2002】1号字","m7":"sdfs,dfsdf,122,sss","m8":"2012-11-07","s2":"2012","s10":0,"s1":"永久","m11":"sdfsdf","m12":"李四","s7":"1","m15":"档案室","m16":"情况说明","s3":"","m19":2,"m20":"sdfs","m23":"绝密","s14":1,"s15":0,"m26":"","s5":"1","s6":"65891","s4":"m29m29m29m29m31","m29":"2012-11-09 16:36:33","m30":"2012-11-09 16:36:33","m31":0,"m32":"","s11":"0413","s12":"0413","s13":"admin","s18":"abc,123,abc,123"},像这种不确定键值的字符串怎么解析
展开
展开全部
这个你不需要理会,json的组装方式就是这样的,你只需要按钮普通的取值方式从它里面取就行了如:把传过的的对象当成是map的话,就int num = (Integer) map.get("s0"); //413
String m1 = map.get("m1").toString(); //"sdfs,123,sdf,sdfsdf,sdfsdf"
String m1 = map.get("m1").toString(); //"sdfs,123,sdf,sdfsdf,sdfsdf"
更多追问追答
追问
因为我这个方法是公用的,字符串中的s1,m1等都不是确定的,也许有的字符串中有s1,而有的没有,所以不能确定get中的值
追答
那你干脆就取对象就行了,
for (Objcet o : map) {
system.out.println(o.toString());
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询