Hi
On 08/10/12 12:30, sireesh wrote:
Hi Sergey,

I tried using JacksonJaxbJsonProvider for unmarshalling my json.
But, I'm getting the below exception:

/org.codehaus.jackson.map.JsonMappingException: Can not instantiate value of
type [simple type, class javax.xml.bind.JAXBElement<java.lang.String>] from
JSON String; no single-String constructor/factory method (through reference
chain:
com.abc.domain.ValidationRequest["Header"]->com.abc.domain.Header["ProductIdentifier"])/

I googled for the exception, but I couldn't find any clue.
Unlike for the  default org.apache.cxf.jaxrs.provider.JSONProvider, I
couldn't find much relevant configurations I can override for
JacksonJaxbJsonProvider.
Can you please let me know if there are any configurations I've missed for
unmarshalling properly

I also tried to use JacksonJaxbJsonProvider for marshalling my response
object to json.
Jackson is generating the schema details in the result json.
e.g:
{
     "Header": {
         "ProductIdentifier": {
             "name": "{Mynamespace}ProductIdentifier",
             "declaredType": "java.lang.String",
             "scope": "com.abc.jaxb.domain.Header",
             "value": "MyProd",
             "nil": false,
             "globalScope": false,
             "typeSubstituted": false
         }
....
}

I just need to output the value of the product identifier. I do not want to
output the all the schema details as the receiver of the json is aware of
the schema and it cannot consume this resultant json.

I haven't had any experience with Jackson. I wonder if you should try and 'break' a link with JAXB, when attempting to read JSON with Jackson, and use its default (non JAXB) provider, I'm sure it has to be capable of reading duplicate keys properly. In meantime I'll try to deploy a Jettison snapshot with a fix asap - will take few days, but one way or another the issue will be sorted out

Sergey






--
View this message in context: 
http://cxf.547215.n5.nabble.com/JSONProvider-unable-to-unmarshal-json-containing-list-of-elements-tp5715651p5716002.html
Sent from the cxf-user mailing list archive at Nabble.com.


--
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com

Reply via email to