JsonUtil { public static String toJSONString(Object bean) { return getJsonable().toJSONString(bean); }  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 对象ToJson() { JsonUtil.DEFAULT_JSON = JsonUtil.FAST_JSON; String objectToJson = JsonUtil.toJSONString(user); System.out.println(objectToJson); }
@Test public void mapToJson() { String objectToJson = JsonUtil.toJSONString(map); System.out.println(objectToJson); }
@Test public void arrayToJson() { String objectToJson = JsonUtil.toJSONString(array); System.out.println(objectToJson); }
@Test public void listToJson() { String objectToJson = JsonUtil.toJSONString(users); System.out.println(objectToJson); }
@Test public void setToJson() { String objectToJson = JsonUtil.toJSONString(userSet); System.out.println(objectToJson); }