在解析JSON的时候,除了
代码:
public static void testMe() {Map map = new HashMap();map.put("1", "2");map.put("weq", "asd");map.put("qw", "");List list = new ArrayList();list.add(map);list.add(map);list.add(null);String str1 = String.valueOf(list);System.out.println(String.valueOf(list));List ss = JSON.parseObject(str1,List.class);}
报错信息:
Exception in thread "main" com.alibaba.fastjson.JSONException: parse number key errorpos 3, json : [{1=2, weq=asd, qw=}, {1=2, weq=asd, qw=}, null]
at com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(DefaultJSONParser.java:295)
at com.alibaba.fastjson.parser.DefaultJSONParser.parse(DefaultJSONParser.java:1335)