cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: setReadNullAsEmptyString in JSONProvider (Jettison 1.3.5) doesn't work
Date Thu, 03 Apr 2014 09:58:19 GMT
Hi
On 03/04/14 07:55, Jose MarĂ­a Zaragoza wrote:
> Hello:
>
>
> I'm using CXF 2.7.10 + Jettison 1.3.5
>
> When my service receives a JSON payload with a field like
>
> {"field":null}
>
> is always mapped  to empty string (in the JAXB object )
>
> If I configure JSONProvider to
>
> setReadNullAsEmptyString(false)
>
> , the result is the same
>
> I would like to map {"field":null}  to null value
>
> What am I doing wrong ?
>

The property is used to control the case where we have

{"field":"null"}

which is apparently one way to specify that a given value is null, it is 
more JavaScript friendly may be, etc. So this property will help 
avoiding a given field set with a "null" String value.

Now, as far as I recall, JAXB calls XMLStreamReader getTextCharacters 
variant returning the array, which have to be empty if no characters 
exist, and as such JAXB sets the String field to "".

There may be a way to control it at JAXB level alone...

HTH, Sergey



>
> Regards
>


Mime
View raw message