users@jersey.java.net

[Jersey] Re: Unmarshalled JSON not populating object fields when rootUnwrapping==true

From: charlesk <charlesk40_at_yahoo.com>
Date: Thu, 14 Jul 2011 14:07:50 -0700 (PDT)

Marshalled JSON produced using the JSONMarshaller with rootUnwrapping==false
{
    "mybean": {
        "@id": "1234",
        "@locale": "ES",
        "@xml.lang": "es-ES",
        "nameelement": "*element name*",
        "email": " foo_at_xyz.com"
    }
}
Marshalled JSON produced using the JSONMarshaller with rootUnwrapping==true
{
    "@locale": "ES",
    "@id": "1234",
    "@lang": "es-ES",
    "email": " foo_at_xyz.com",
    "nameelement": "*element name*"
}
So marshalling works as expected.

Now, feeding these JSONs into the unmarshaller (with the same
jsonconfiguration as marshaller) produces correct unmarshalled objects with
fields populated.

However, below case where JSON is provided with root BUT when
rootUnwrapping==true, then the unmarshalled objects have blank fields. I
believe JSON should match with what we have configured in Jsonconfiguration.
If it doesn't, it seems like unmarshalled objects will have blank fields.
Is this correct understanding?

{
    "mybean": {
        "@id": "1234",
        "@locale": "ES",
        "@xml.lang": "es-ES",
        "nameelement": "*element name*",
        "email": " foo_at_xyz.com"
    }
}

--
View this message in context: http://jersey.576304.n2.nabble.com/Unmarshalled-JSON-not-populating-object-fields-when-rootUnwrapping-true-tp6581733p6584890.html
Sent from the Jersey mailing list archive at Nabble.com.