1.前端傳來的json字符串, 用json-lib 轉(zhuǎn)為javaBean '{"updated":[],"deleted":[{"busiMode":1,"createTime":"","id":88,"product":{"code":"8513456","user":{}},"storeWeight":0}],"eid":2}' // JSONObject js = JSONObject.fromObject(pdui); // Map<String, Class> classMap = new HashMap<String, Class>(); // classMap.put("deleted", EP.class);//對象里涉及到集合 // classMap.put("updated", EP.class); // ProductDUI productDui=(ProductDUI) js.toBean(js, ProductDUI.class,classMap); |
|