You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Andrew Clark <an...@hotmail.com> on 2014/02/27 16:05:26 UTC

Using Jettison or Jackson

Hi,
I have written a REST service using the default CXF jettison provider to handle JSON. When returning JSON which should contain lists I have experienced the issue of single lists being returned as an element.
Using the serializeAsArray and the arrayKeys property of the JSONProvider I am able to stop this happening and get the correct response.
My questions are:
A) I have read that Jettison will not encounter this problem because of the way that the java is marshalled, but the downside is it cannot validate a JSON request/response. As request and response validation is essential can this be done in Jackson, and are there any other advantages in moving to Jackson over Jettison.
B) If I stick with jettison is there anyway to avoid having to populate the arrayKeys property with all the elements i wish to be a list and still achieve the same result?
ThanksAndy 		 	   		  

Re: Using Jettison or Jackson

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
It is really up to you. Many people like Jackson, as far as I'm 
concerned I think configuring Jettison may be a bit easier in certain 
situations; it is not streaming yet so the bigger the payload the slower 
it is, though I think in most cases the payloads are actua;;y small. 
Experiment with both providers, see what is better for you...

Cheers, Sergey
On 27/02/14 15:05, Andrew Clark wrote:
> Hi,
> I have written a REST service using the default CXF jettison provider to handle JSON. When returning JSON which should contain lists I have experienced the issue of single lists being returned as an element.
> Using the serializeAsArray and the arrayKeys property of the JSONProvider I am able to stop this happening and get the correct response.
> My questions are:
> A) I have read that Jettison will not encounter this problem because of the way that the java is marshalled, but the downside is it cannot validate a JSON request/response. As request and response validation is essential can this be done in Jackson, and are there any other advantages in moving to Jackson over Jettison.
> B) If I stick with jettison is there anyway to avoid having to populate the arrayKeys property with all the elements i wish to be a list and still achieve the same result?
> ThanksAndy 		 	   		
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: Using Jettison or Jackson

Posted by Jose MarĂ­a Zaragoza <de...@gmail.com>.
2014-02-27 16:05 GMT+01:00 Andrew Clark <an...@hotmail.com>:
> Hi,
> I have written a REST service using the default CXF jettison provider to handle JSON. When returning JSON which should contain lists I have experienced the issue of single lists being returned as an element.
> Using the serializeAsArray and the arrayKeys property of the JSONProvider I am able to stop this happening and get the correct response.
> My questions are:
> A) I have read that Jettison will not encounter this problem because of the way that the java is marshalled, but the downside is it cannot validate a JSON request/response. As request and response validation is essential can this be done in Jackson, and are there any other advantages in moving to Jackson over Jettison.

I do schema-validation with Jettison and it works fine OK ( I only
checked requests )


> B) If I stick with jettison is there anyway to avoid having to populate the arrayKeys property with all the elements i wish to be a list and still achieve the same result?
> ThanksAndy