You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by erwincc <er...@gmail.com> on 2014/02/04 07:03:56 UTC

Converting from java to json, drops objects that are null

Currently CXF when converting from java to json, drops objects that are null. 

For example,

object{
  child_1 = null;
  child_2 = new Object();
}

existing JSON output is   {object:{child_2:{some value}}

Instead of not returning child1, is it possible to have it default to empty
string?

         {object:{child_1:"", child_2:{some value}}


Thanks in advance.




--
View this message in context: http://cxf.547215.n5.nabble.com/Converting-from-java-to-json-drops-objects-that-are-null-tp5739426.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Converting from java to json, drops objects that are null

Posted by Sergey Beryozkin <sb...@gmail.com>.
You probably need to add a nillable property to a given JAXB XMLElement

cheers, Sergey
On 04/02/14 06:03, erwincc wrote:
> Currently CXF when converting from java to json, drops objects that are null.
>
> For example,
>
> object{
>    child_1 = null;
>    child_2 = new Object();
> }
>
> existing JSON output is   {object:{child_2:{some value}}
>
> Instead of not returning child1, is it possible to have it default to empty
> string?
>
>           {object:{child_1:"", child_2:{some value}}
>
>
> Thanks in advance.
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Converting-from-java-to-json-drops-objects-that-are-null-tp5739426.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>