use of com.alibaba.fastjson.serializer.SerializerFeature in project fastjson by alibaba.
the class EnumTest2 method test_enum.
public void test_enum() throws Exception {
Date date = new Date(1308841916550L);
// 1308841916550
Assert.assertEquals("1308841916550", JSON.toJSONString(date));
// "2011-06-23T23:11:56.550"
System.out.println(JSON.toJSONString(date, SerializerFeature.UseISO8601DateFormat));
SerializerFeature[] features = { SerializerFeature.UseISO8601DateFormat, SerializerFeature.UseSingleQuotes };
// '2011-06-23T23:11:56.550'
System.out.println(JSON.toJSONString(date, features));
}
Aggregations