Hi Jalpesh,
What you are observing is a consequence of mapping attributes of the
XML infoset to JSON. So it is the expected behavior from the Jersey
JSON/JAXB convention.
Paul.
On May 29, 2009, at 2:25 PM, Jalpesh Patadia wrote:
> Hello everyone,
>
> My question is similar to what Chad asked in his post, but I’m
> seeing a slightly different behavior :
>
> https://jersey.dev.java.net/servlets/ReadMsg?listName=users&msgNo=6120
>
>
> Basically I have some POJO fields which are defined with the
> @XmlElement element as follows :
>
> @XmlElement(nillable = true) private String status;
>
> Now, when I display the output as application/xml – I get the
> correct value :
>
> <status xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
> "/>
>
> However when I use application/json as the output I get :
>
> "status" : {
> "@nil" : "true"
> }
>
> Which seems incorrect. According to the JSON spec, it be more like :
>
> "status" : null
>
>
> I’m using Jersey 1.0.3. Not sure if this is a bug or working as
> designed. If it’s working as designed, is there a way to make it
> confirm to the JSON spec ?
>
>
> Thanks,
>
>
> Jalpesh
>
>
>
>
> PRIVILEGED AND CONFIDENTIAL
> This transmission may contain privileged, proprietary or
> confidential information. If you are not the intended recipient, you
> are instructed not to review this transmission. If you are not the
> intended recipient, please notify the sender that you received this
> message and delete this transmission from your system.