json转对象+对象转json+json转字符串+字符串转json

json转对象

 User user = (User)JSON.parseObject(jsonStr,User.class);

对象转json

JSONObject json = JSONObject.fromObject(obj);

字符串转json

JSONObject jsonStr = JSONObject.parseObject(str);

json转字符串

jsonStr.toString();    //用不上

 

猜你喜欢

转载自www.cnblogs.com/book-mountain/p/11602137.html
今日推荐