需求
{"GuoChe":{"cb":"BMW","cpys":"xxxx","hphm":"冀A12345"},"code":200,"msg":"success"}
代码:
// ==============过车=============
WatchInfo watchMap = new WatchInfo();
watchMap.setHphm("冀A12345");
watchMap.setCpys("xxxx");
watchMap.setCb("BMW");
Object json = JSONObject.toJSON(watchMap);
// ===========================
JSONObject objData = new JSONObject();
objData.put("GuoChe", json);
objData.put("code", 200);
objData.put("msg", "success");
System.out.println(objData.toString());