2014-04-03 11:58 GMT+02:00 Sergey Beryozkin <[email protected]>:
> 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...


Thanks


Finally I had to do it with a CustomAdapter and the annotation
@XmlJavaTypeAdapter(CustomAdapter.class)
because

@XmlElement(nillable = true)
doesn't work for me

do you know why ?

Regards





>
> HTH, Sergey
>
>
>
>>
>> Regards
>>
>

Reply via email to