json - how to poperly deserialize dates in resteasy 3 -
i use resteasy 3.0.8.final in wildfly8.1. when post date in json
can not construct instance of java.util.date string value '2014-06-20 12:00:00': not valid representation (error: failed parse date value '2014-06-20 12:00:00': can not parse date "2014-06-20 12:00:00": not compatible of standard forms ("yyyy-mm-dd't'hh:mm:ss.sssz", "yyyy-mm-dd't'hh:mm:ss.sss'z'", "eee, dd mmm yyyy hh:mm:ss zzz", "yyyy-mm-dd"))
i had tried standard formats mentioned same message.
how can configure resteasy parse date format want?
you need include jackson annotations package used rest easy.
<dependency> <groupid>com.fasterxml.jackson.core</groupid> <artifactid>jackson-annotations</artifactid> <version>2.3.2</version> <scope>provided</scope> </dependency>
next need annotate date fields jsonformat annotation specify output format.
@jsonformat(pattern = "yyyy-mm-dd hh:mm:ss")
the other option post date's in 1 of supported formats.
Comments
Post a Comment