I have a simple service with the following method in the service endpoint
interface:

public Collection<String> getNames();

This service is exposed in CXF as a ReST service, returning JSON.  It seems
to work as expected, most of the time.  The collection would be represented
in JSON as, for example: ["name1","name2"].  However, if there's only one
element in the array, the brackets are missing: "name1".  Thus, it looks
like just a scalar value, which confuses the consuming client.

I'm not sure if this is a CXF issue or a problem in Jettison.  There does
seem to be a bug for something like this in the Jettison project: 
http://jira.codehaus.org/browse/JETTISON-22.  However, this seems to have
been fixed in the most recent version of Jettison, and the version included
with the CXF distribution should have the fix.  Anyone else have any idea
why it's doing this?  Thanks.

FYI, I'm using CXF 2.0.5.
-- 
View this message in context: 
http://www.nabble.com/ReST-JSON-and-arrays-tp16971013p16971013.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to