JsonUtil { public static <T> T toBean(String json, Class<T> beanClass) { return getJsonable().toBean(json, beanClass); }  static String toJSONString(Object bean); static String toJSONString(Object bean, String... excludes); static JSONObject toJSON(Object bean,String... excludes); static JSONObject toJSON(Object bean); static JSONArray toJSONArray(Object bean,String... excludes); static JSONArray toJSONArray(Object bean); static T toBean(String json, Class<T> beanClass); static List<T> toList(String json, Class<T> beanClass); static final String FAST_JSON; static final String JSON_LIB; static String DEFFAULT_DATE_FORMAT; static String DEFAULT_JSON; }
@Test public void toObject(){ String str = "{\"date\":\"2015-07-06 12:06:47\",\"id\":1,\"name\":\"xxx\",\"user\":[]}"; User object = JsonUtil.toBean(str, User.class); System.out.println(object); }