FASTJSON 增加对泛型的支持
程序员文章站
2023-12-29 15:21:52
...
FASTJSON 默认没有开启对泛型的支持。通过SerializerFeature.WriteClassName增加
Map<String, Date> map = new HashMap<String, Date>(); map.put("now", new Date()); String str = JSON.toJSONString(map,SerializerFeature.WriteClassName); System.out.println(str); Map<String, Date> result = JSON.parseObject(str, map.getClass()); System.out.println(result.get("now").getClass());