Jackson + MongoDB's ObjectId

This two classes should help you change the way Jackson serialization works for MongoDB's ObjectId. If you don't annotate your ObjectId fields with this classes, you should be receiving something like this:

"id":{
  "new":false,
  "machine":-2068967138,
  "timeSecond":1355228408,
  "inc":175606344,
  "time":1355228408000
}

In my case, I needed my ObjectId's as:

"id":"50c724f884ae111e0a778a48"

Well, here are the classes:



No hay comentarios:

Publicar un comentario