users@jersey.java.net

Re: [Jersey] Unmarshalled JSON not populating original class is was marshalled from.

From: Jakub Podlesak <Jakub.Podlesak_at_Sun.COM>
Date: Tue, 05 Jan 2010 20:24:19 +0100

On Tue, Jan 05, 2010 at 07:04:58PM +0000, Paul Taylor wrote:
> Jakub Podlesak wrote:
> >Hi Paul,
> >
> >could you please share your JAXB beans? Without that it is hard to tell
> >what is going wrong in your case.
> >The best would be to file a new bug report and attach a reproducible
> >test case as a maven project. If that is not possible, could you please
> >just send the JAXB bean sources and an example code populating
> >the marshalled instance?
> >
> >Thanks,
> >
> >~Jakub
> >
> Ok, I'll try but it it always take some time to get nicely packaged test

that is why i suggested you send at least the beans source code,

> cases, but I take it from your answer that this should normally work
> then , i.e Bean - JSON - Bean

yes, this should work and it should work even for inheritance structures,
i.e. ChildBean extends ParentBean scenarios, where you serialize ParentBean
containing ChildBean instance, but then you
need to preserve the "root tag" JSON equivalent (rootUnwrapping==false) and sometimes
you need to support namespaces.

You might want to try at your side with JSON config built with st. like
JSONConfiguration.natural().rootUnwrapping(false).build()
and then let me know.

Anyway, sending the JAXB beans source would help,

~Jakub

>
>
> Paul
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>

-- 
http://blogs.sun.com/japod