users@jersey.java.net

[Jersey] Re: JSON / XML unmarshaller problem

From: Jakub Podlesak <jakub.podlesak_at_oracle.com>
Date: Fri, 29 Apr 2011 12:08:51 +0200

Hi Jairo,

FEATURE_POJO_MAPPING simply allows you to do JSON processing
with all Java objects. It is not restricted to JAXB beans only, as opposed
to the default Jersey JSON approach (maintained just for backwards
compatibility reason).

I guess you happen to use only JAXB beans, and then you do not see
the need to use the above feature. On the other hand, if you look
at the JSON generated using different methods (the FEATURE_POJO_MAPPING
feature switched on/off, different Jersey JSON notations), you might see
some differences. You may want to check [1] for some more detailed
information.

Anyway, i would strongly recommend using the Jackson based
FEATURE_POJO_MAPPING feature in Jersey even for JAXB beans,
for it's truly natural Java<->JSON mapping.

HTH,

~Jakub

[1]http://jersey.java.net/nonav/documentation/latest/json.html

On 04/14/2011 03:45 PM, Jairo1 wrote:
> My question 2. is partially answered:
> I removed package-info.java class from my JBuilder project and added proper
> 'namespace' to MyClass bean.
> This solved my problem with receiveing/unmarshalling correct XML and JSON
> data to my REST client.
>
> After this change FEATURE_POJO_MAPPING is not necessary to deserialize JSON
> data in JBuilder client.
>
>
> But issues asked in 1. and 3. are still mysteries for me.
>
> 1.It seems that FEATURE_POJO_MAPPING configuration is not needed in all
> cases. So when this is required?
> 2.JBuilder2006 doesn't accept annotation for package-info.java
> 3.It seems the problem was uncompiled package-info.java in JBuilder2006.
> But why JSON format unmarshalled the data and XML approach not for incorrect
> package-info.java?
>
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/JSON-XML-unmarshaller-problem-tp6269059p6272844.html
> Sent from the Jersey mailing list archive at Nabble.com.
>