JsonHelper { public static String toJson(Object object) { if (object == null) { return null; } return GSON.toJson(object); }  static byte[] toBytes(Object object); static String toJson(Object object); static T fromJson(String json, Class<T> clazz); static T fromJson(byte[] bytes, Class<T> clazz);  }
@Test public void toJson() { Bean bean = new Bean(); bean.setA("aaaa"); bean.setB(123); bean.setC(new Date(1000000L)); String json = JsonHelper.toJson(bean); Assert.assertEquals("{\"a\":\"aaaa\",\"b\":123,\"c\":\"Jan 1, 1970 8:16:40 AM\"}", json); }