users@jersey.java.net

[Jersey] Re: Best way to diagnose a 400 error on POST

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Thu, 16 Dec 2010 12:00:28 +0100

On Dec 15, 2010, at 6:14 PM, Jason Erickson wrote:

> Hmm... I didn't try that. I tried @XmlElements(@XmlElement(type =
> Person.class)) and that seemed to work. I had previously thought
> that annotation was only for collections, but it worked for me here.
>
> I have seen in other JSON where "type" appears as a field, but that
> wasn't working in this case for some reason. Also, it can be kind
> of confusing with namespaces, since there is no way in JSON notation
> to specify a namespace prefix, but it nonetheless shows up. For
> example, I've seen: "type":"ns2:scaleObservation". What the heck is
> ns2? It's not bad if I'm both the author and the consumer of the
> service, but for a third party, it can be pretty confusing.
>

Agreed, this kind of thing is awkward when maping XML artifacts to/
from JSON.


> Anyway, that's an aside. My current problem is solved and thanks
> everyone for the help.
>

Great,
Paul.