json - Returning specific date format with Jackson -
i trying return date on json object specific format: format:
"lastmodified": "2015-08-04t13:09:15.000-07:00",
i have custom objectmapper this:
result.setdateformat(new iso8601dateformat());
but result: "lastmodified": "2015-08-04t20:09:15z"
any ideas how change it? using:
<dependency> <groupid>org.glassfish.jersey.media</groupid> <artifactid>jersey-media-json-jackson</artifactid> <version>2.22.1</version> <scope>runtime</scope> </dependency>
and before used older version of: org.codehaus.jackson
update: after adding line:
result.configure(com.fasterxml.jackson.databind.serializationfeature. write_dates_as_timestamps , false);
and removed:
result.setdateformat(new iso8601dateformat());
i got result: "lastmodified": "2015-08-04t20:09:15.000+0000", still not want.
this right format:
result.setdateformat(new simpledateformat("yyyy-mm-dd't'hh:mm:ss.sssxxx"));
Comments
Post a Comment