views:

11

answers:

0

Hello All,

I am using Apache CXF RS to produce a REST service which accepts both XML and JSON as input. I use the default JSON provider i.e. Jettison.

My trouble starts when my input json has an array in it. For example,

{ person:{ telephone:[ { type: "mobile", number: "123" }, { type: "work", number: "456" } ] } }

This is a valid json convention representing an array of telephone objects. The service fails to recognise the "telephone" elements (infact it says no telephone object exists in the request).

Going through the documentation in apache cxf, the serializeAsArray and arrayKeys attribute used to over come JSON arrat serialisation issue for JSONProvider only works while writing the response back and not during the request reading.

Has anyone tried sending array of objects through JSON in to a REST service? If so, could you let me know why this is failing.

PS: The same REST service when passed with a XML request was successfully able to read the telephone object values