Assume we have a naive User POJO class with a BSON Type ObjectId field, i.e., id.
public class User { private ObjectId id; private String username; private String password; private Date createdAt; public getters/setters; ... We can expect the following outputs from our REST services which is not a String with 24 hex characters.
{ "_id": { "new": false, "machine": 805608948, "timeSecond": 1403022678, "inc": -871980150, "time": 1403022678000 }, "username": "John Smith", "password": "am9obiBzbWl0aCBwYXNzd29yZA", "createdAt": 1403022678341 } As we know, it can be solved by using the Jackson annotation for configuring Serializer class to serialize the associated value. ...