users@jersey.java.net

Re: [Jersey] JSON deserialization issue

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 21 Apr 2009 08:37:53 +0200

Hi Gene,

Does this work correctly when you marshall and unmarshall to/from XML?

Can you send an example of the serialized JSON?

Can you describe a bit more how you are de-serializing?

I wonder if it is the namespace declarations:

   @OneToMany(mappedBy = "participant", cascade = CascadeType.ALL,
              fetch = FetchType.EAGER)
   @XmlElement(name = "Group",
               namespace = "urn:com:lmco:energyc2:seeload:participantsvc:ejb
")
   private List<Group> group;

   @OneToMany(mappedBy = "participant", cascade = CascadeType.ALL,
              fetch = FetchType.EAGER)
   @XmlElement(name = "LoadControlDevice",
               namespace = "urn:com:lmco:energyc2:seeload:participantsvc:ejb
")
   private List<LoadControlDevice> loadControlDevice;

IIRC there are some issue with namespaces and JSON. Jakub knows more
about this than I.

Paul.

On Apr 21, 2009, at 12:10 AM, Turner, George wrote:

> I am trying to get some help on resolving an issue on some new code
> using 1.0.3 that is using the “natural” implementation for JSON.
> My classes all have JAX XML annotations, as created using JAXB XJC.
>
> I have a top level parent Participant class containing two Lists of
> child Group and Devices classes. The Group and Device classes have
> a reference to parent Participant that is annotated XMLTransient.
>
> When I serialize to JSON, everything works fine, but when the JSON
> de-serializes to Java, the Lists are null.
>
> If anyone can provide some pointers as to what is happening or how
> to fix it, it would be greatly appreciated.
>
> The classes are attached. ( I have already tried removing the
> XmlType and XmlRootElement annotations in the child classes with no
> change)
>
> George (Gene) Turner
> <image001.png>
> Senior Staff Software Engineer
> Information Systems & Global Services
> Work:(719) 277-5244 Cell:(719) 237-0490
> george.turner_at_lmco.com
>
>
> <LoadControlDevice.java><Participant.java><Group.java>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net