摘要: 转载http://blog.csdn.net/hongwangzhang/article/details/51260879 在日志解析,前后端数据传输交互中,经常会遇到 String 与 map、json、xml 等格式相互转换与解析的场景,其中 json 基本成为了跨语言、跨前后端的事实上的标准数 阅读全文
posted @ 2017-04-03 11:26 小学生II 阅读(10384) 评论(0) 推荐(0) 编辑
摘要: 前提是String的格式是map或json类型的 String 转Json JSONObject jasonObject = JSONObject.fromObject(str); String 转Map JSONObject jasonObject = JSONObject.fromObject( 阅读全文
posted @ 2017-04-03 11:23 小学生II 阅读(325) 评论(0) 推荐(0) 编辑
摘要: 普通JavaBean(以User为例)转成json格式 1.转成JSONArray类型 User user = new User(); user.setUsername("cxl"); user.setPassword("1234"); JSONArray json = JSONArray.from 阅读全文
posted @ 2017-04-03 11:22 小学生II 阅读(194) 评论(0) 推荐(0) 编辑