@Test public void toObject(){ String str = "{\"date\":\"2015-07-06 12:06:47\",\"id\":1,\"name\":\"xxx\",\"user\":[]}"; User object = jsonlib.toBean(str, User.class); System.out.println(object); }
@SuppressWarnings("unchecked") @Override public <T> T toBean(String json, Class<T> beanClass) { JSONObject fromObject = JSONObject.fromObject(json); T result = (T) JSONObject.toBean(fromObject, beanClass); return result; }
JsonLib implements Jsonable { @SuppressWarnings("unchecked") @Override public <T> T toBean(String json, Class<T> beanClass) { JSONObject fromObject = JSONObject.fromObject(json); T result = (T) JSONObject.toBean(fromObject, beanClass); return result; } }
JsonLib implements Jsonable { @SuppressWarnings("unchecked") @Override public <T> T toBean(String json, Class<T> beanClass) { JSONObject fromObject = JSONObject.fromObject(json); T result = (T) JSONObject.toBean(fromObject, beanClass); return result; }  }
JsonLib implements Jsonable { @SuppressWarnings("unchecked") @Override public <T> T toBean(String json, Class<T> beanClass) { JSONObject fromObject = JSONObject.fromObject(json); T result = (T) JSONObject.toBean(fromObject, beanClass); return result; }  String toJSONString(Object bean); @SuppressWarnings("unchecked") @Override T toBean(String json, Class<T> beanClass); @SuppressWarnings("unchecked") @Override List<T> toList(String json, Class<T> beanClass); @Override void setDatePattern(String datePattern); @Override void setExcludes(String[] excludes); @Override com.alibaba.fastjson.JSONObject toJSON(Object bean); @Override com.alibaba.fastjson.JSONArray toJSONArray(Object bean); }
JsonLib implements Jsonable { @SuppressWarnings("unchecked") @Override public <T> T toBean(String json, Class<T> beanClass) { JSONObject fromObject = JSONObject.fromObject(json); T result = (T) JSONObject.toBean(fromObject, beanClass); return result; }  String toJSONString(Object bean); @SuppressWarnings("unchecked") @Override T toBean(String json, Class<T> beanClass); @SuppressWarnings("unchecked") @Override List<T> toList(String json, Class<T> beanClass); @Override void setDatePattern(String datePattern); @Override void setExcludes(String[] excludes); @Override com.alibaba.fastjson.JSONObject toJSON(Object bean); @Override com.alibaba.fastjson.JSONArray toJSONArray(Object bean);  }