JSon数据转换

2019-04-15 16:53发布

[{"categoryId":1,"id":12,"pic":"http://192.168.25.133/group1/M00/00/00/wKgZhVtdxUSAYHLFAAIzc8YtGlU294.jpg",
"sortOrder":0,"status":"1","title":"123","url":"http://www.baidu.com"},
{"categoryId":1,"id":5,"pic":"http://192.168.25.133/group1/M00/00/00/wKgZhVnIhVqAAa0jAActhhatATY291.png","sortOrder":3,"status":"1","title":"测试广告","url":"http://www.baidu.com"},
{"categoryId":1,"id":9,"pic":"http://192.168.25.133/group1/M00/00/00/wKgZhVnJ1pyAFbWqAAFyVK2N7Ig973.jpg","sortOrder":6,"status":"1","title":"1元秒月饼","url":"http://www.163.com"},
{"categoryId":1,"id":8,"pic":"http://192.168.25.133/group1/M00/00/00/wKgZhVnJrmSAc6LvAAJLX6bBPuo913.jpg","sortOrder":10,"status":"1","title":"这是一个广告","url":"http://www.baidu.com"},
{"categoryId":1,"id":10,"pic":"http://192.168.25.133/group1/M00/00/00/wKgZhVtdw82AdlHdAARvEA6F83U388.jpg","sortOrder":123,"status":"1","title":"123","url":"123"}] 总结: 第一: 前端和后台结合最终要靠的是数据:
       前端是json 后台是 map。都是键值对
       转换:fastJson 
       注意点。map也属于对象
       1.后台将数据转换为json格式的字符串:
         String json=json.parse();
       2.后台将json格式的字符串转换成map 或者封装对象
         json.parseObject(json字符串,对象的.classs); 第二:前台的json转换。
       Json.Stringfy(json对象); //将json对象转成json串。
       Json.parse(json字符串);将json字符串转换成json对象