On May 4, 2009, at 9:33 AM, Felipe Gaúcho wrote:
> I know Jersey supports the three most common JSON formats through
> providers, etc...
>
Just to be clear, there is only one JSON format: the syntax of JSON.
There are a number of JSON conventions (or notations) for mapping XML
infoset to JSON.
> question: how compatible is the default JSON format of Jersey with
> other JSON consumers ?
>
All JSON conventions should parse by a conforming JSON parser. But all
not conventions are easy to consume.
> and which is the best portable format to use (if not the default) ?
>
They are all portable. The question to ask is the following: which
convention makes it easier for clients to consume?
IMHO i would avoid using something like BadgerFish unless you have to
use it because it exposes a bunch of XML artifacts in the JSON that
make it hard for clients to consume. You might as well use XML.
Out of all the conventions currently supported the JAXB/natural
convention supports the most consumable JSON. Some XML artifacts are
still exposed like a naming convention for XML attributes (to
distinguish from XML elements of the same name).
Tatu is working in a convention to map Java objects to JSON that will
not have any XML artifacts exposed because it does not go though an
XML infoset layer.
Paul.