java中 将对象转换为json

来源:互联网 发布:加工中心编程100例 编辑:程序博客网 时间:2024/05/24 04:48


// 1、定义 ObjectMapper 对象ObjectMapper mapper =new ObjectMapper();// 2、将指定对象转为jsonString json= mapper.writeValueAsString(httpResult); // 将 httpResult 转为json格式的字符串。

0 0
原创粉丝点击