JAX-RS JSON java.util.Date Unmarshall

Posted by user229498 on Stack Overflow See other posts from Stack Overflow or by user229498
Published on 2010-06-16T10:38:43Z Indexed on 2010/06/16 10:42 UTC
Read the original article Hit count: 488

Hi, I'm using Jersey (jax-rs), to build a REST rich application.

Everything is great, but I really don't understand how to set in JSON Marshalling and Unmarshalling converting option for dates and numbers.

I have a User class:

@XmlRootElement
public class User {
    private String username;
    private String password;
    private java.util.Date createdOn;

    // ... getters and setters
}

When createdOn property is serialized, a string like this: '2010-05-12T00:00:00+02:00', but I need to choose date Pattern both, to marshall and unmarshall.

Someone knows hot to do that?

Thank's a lot, Davide.

© Stack Overflow or respective owner

Related posts about JSON

Related posts about conversion