Hi,
I just want to confirm what Tatu says.
We have taken a very conservative approach to on the wire compatibility.
With hindsight and appropriate timing we would have chosen Jackson as
the default with NATURAL as the second choice. I would like to do that
for Jersey 2.0. I personally no longer see the point in using
Jettision mapped or BadgerFish. For such circumstances one really
should stick with XML as i don't believe turning such XML infoset into
JSON makes it any easier to consume, especially when there could be
mixed content present, and it tends to obfuscate what the actual JSON
looks like.
Paul.
On Nov 23, 2010, at 7:13 PM, Tatu Saloranta wrote:
> Hi Mike! While I'm not Paul or member of Jersey team, I think this
> is due to historical reasons, i.e. defaults are based on what was
> added first. Jackson-based natural mapping was about the last thing
> to be added.
>
> I personally agree in your assessment about relative merits of
> choices, but I also see how backwards compatibility is important --
> changing defaults would change JSON structure being produced and
> accepted, and that would cause problems with users who have managed
> to get through all issues with Badgerfish & mapped notations.
>
> But I also think there has been movement towards changing defaults
> slowly over time; and especially making re-configuration as simple
> as possible.
>
> -+ Tatu +-
>
> --- On Mon, 11/22/10, Mike Meessen <netmikey.ml_at_gmail.com> wrote:
>
> From: Mike Meessen <netmikey.ml_at_gmail.com>
> Subject: Jersey's default JSON notation
> To: dev_at_jersey.java.net
> Date: Monday, November 22, 2010, 10:01 AM
>
> Hi there,
>
> First of all, allow me to join the chorus: JAX-RS and Jersey are
> really great and fun to use! This is what web services should have
> been from the beginning ;-) Also, greetings to Paul Sandoz. It was a
> pleasure attending your talk at Devoxx in Antwerp last week :-)
>
> I fiddled around a bit with JAXB backed Jersey JSON output this
> weekend. This was also my very first time checking out JAX-RS. I
> tried to stay as close to JAX-RS (keeping everything non-Jersey-
> specific) as possible. Everything was really smooth and straight
> forward. There has only been one pitfall that took me quite some
> time to figure out: The JSON notation configuration.
>
> By default, Jersey uses what's called the MAPPED notation. I read
> somewhere that this implementation was just the most straight
> forward one. But oddly enough, it doesn't produce valid JSON (with
> regard to the Java Types behind it). More precisely, numeric values
> are output with double quotes, which makes them strings in JSON.
> Same thing for boolean values. There are also a couple of issues
> with Lists not being represented as they should. I had to switch to
> the NATURAL notation in the JSONConfiguration as explained in [1],
> which, in turn, is not straight forward at all anymore.
>
> I don't see why anybody would want to use the MAPPED notation, or am
> I missing something? From what I understood, JETTISON_MAPPED and
> BADGERFISH are also very special use cases so my guess is that > 90%
> of users would want the NATURAL notation, which is why you really
> should make it the default one.
>
> Best regards,
> Mike
>
> [1] http://jersey.java.net/documentation/1.3/user-guide.html#d4e815
>