Hi, redirecting to the users list,
Please see the very last bean declaration in
http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml
as well as
http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-DealingwithJSONarrayserializationissues
you need to set 'serializeAsArray' and possibly the arrayKeys too.
Jettison does not know, when it is a single value only, if it is a
collection or just a plain property so it needs a hint
Cheers, Sergey
On 27/06/12 15:25, Ganesh wrote:
We are using cxf freamwork for webservice development. In the response we are
using *"application/json"*.
So while converting collection to JSON array jettison behaving differently
based on the count in the collection.
If more than one entries found in the collection it's constructing an array
like the below one,
"Phonenumber": [
{
"Type": "Mobile",
"Phone": "5551111"
},
{
"Type": "Home",
"Phone": "5552222"
}
]
If only one entry is found in the collection it's not constructing an array
,
"Phonenumber": {
"Type": "Mobile",
"Phone": "5551111"
}
Do we have any workaround to construct in the standard way(By default
construct array and not consider about the collection count)?
Please help on this.
Thanks,
Ganesh.
--
View this message in context:
http://cxf.547215.n5.nabble.com/Wired-behaviour-in-Jettison-Json-Array-tp5710374.html
Sent from the cxf-dev mailing list archive at Nabble.com.
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com