Hi,
On 07/14/2011 05:10 AM, charlesk wrote:
> Setting rootUnwrapping==true does not populate any of the fields in
> unmarshalled object for JSON unmarshalling. Is this expected behavior?
It depends on what input you try to consume.
For a given JAXB bean instance, you should be able to serialize
it to JSON and back and get an equivalent instance
as long as you use the same JSONConfiguration options
for both serialization and de-serialization.
If the above does not work for you, then it is likely a bug and
i would like to ask you for a reproducible test case, so that
we can fix it.
Also please take into account that there are some limitations in JAXB
based JSON
support in Jersey. These could be worked around using the (preferred)
Jackson based JSON support (see [1]).
> It does seem like unmarshalling should expect to work as this link suggest
> it should work without the XmlRootElement.
>
> http://jaxb.java.net/guide/_XmlRootElement_and_unmarshalling.html
The above described JAXB feature is used internally in Jersey to support
the rootUnwrapping option.
~Jakub
[1]
http://jersey.java.net/nonav/documentation/latest/json.html#d4e901
> "However, sometimes you may need to unmarshal an instance of a type that
> does not have an XmlRootElement . For example, you might dynamically find
> out at the runtime that a certain element has a certain type. For example,
> the following document illustrates an XML instance where the content of
> <someOtherTagName> element is represented by the Foo class. "
>
> Thanks.
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/Unmarshalled-JSON-not-populating-object-fields-when-rootUnwrapping-true-tp6581733p6581733.html
> Sent from the Jersey mailing list archive at Nabble.com.
>