fastjson 将json字符串转化为List<Map<String, Object>>对象

使用阿里巴巴的 fastjson 将 json 字符串格式的字符串转换为响应的对象格式:

String jsonStr = "[{\"name\":\"张三\",\"id\":1},{\"name\":\"李四\",\"id\":2}]";
List> resultList = JSON.parseObject(jsonStr, new TypeReference>>() {});

不限于 List> 对象格式,其他的对象也同样适用。

你可能感兴趣的:(编程技巧,json,java,idea)