users@jersey.java.net

[Jersey] Re: Question regarding json and attributes

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Thu, 5 Jan 2012 11:58:02 -0800

On Thu, Jan 5, 2012 at 11:08 AM, John Yeary <johnyeary_at_gmail.com> wrote:

> Have you looked at BadgerFish for encoding your JSON objects? The
> JAXBContext can be configured to use BadgerFish which handles XML
> attributes and values. I think that BadgerFish uses @ symbols so you may
> need to change that. It does however encode both attributes and elements
> correctly.
>


Alternatively, you could simplify things by using POJO mapping -- since
JSON has no attribute/element distinction, it's much simpler to just ignore
those.
This does not affect XML side since it would still use JAXB which
differentiates between the cases, but there's really no direct connection
between XML and JSON bindings: even when using conventions like Badgerfish,
workflows are fully separate.

-+ Tatu +-