users@jersey.java.net

[Jersey] Re: Jersey JSON with MongoDB ObjectId

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Tue, 8 Feb 2011 11:14:28 -0800

On Tue, Feb 8, 2011 at 10:54 AM, Mike Key <mikey_at_zenbitz.com> wrote:
...
> So would a ContextResolver be necessary here to ensure the
> ObjectId.toString() method is called?  Or is there another way it is
> recommended to produce output for an object I don't have access to annotate
> with JAXB?  This seems like a simple and common issue but I can't seem to
> find the solution...probably looking in the wrong place.

Not sure if this would help, but there is "bson4jackson" extension for
Jackson (normally used for JSON) that allows one to use data binding
with BSON data (native format of MongoDB):
https://github.com/michel-kraemer/bson4jackson
It should be able to handle BSON data types such object ids.

-+ Tatu +-