JSON,JSONOBJECT,JSONARRAY 互转
1.jsonobject转对象:JSONObject json = (JSONObject) JSONObject.toJSON(obj);
PolicyBean vo = JSONObject.toJavaObject(json, PolicyBean.class);
2.List<ConfigEntityVO> attrLists = JSON.parseArray(vo.getAttrs(), ConfigEntityVO.class);
3.JSONObject attrLists = JSON.parseObject(vo.getAttr(), JSONObject.class) ;
4.map转对象 :
Map<String, Object> configUserInfo = null;
configUserInfo = (Map<String, Object>) object.get("userinfo");
userinfo = JSONObject.parseObject(JSONObject.toJSONString(configUserInfo), UserLoginDTO.class);

浙公网安备 33010602011771号