Can you please give me more info about this issue ? cheers, Sergey
Sergey Beryozkin-2 wrote: > > Actually, you did say your data are in the XML file. > So can you please post a sample resource class with a method showing how > the data is being returned ? > > Just would like to see a bit better how JSONProvider does (eventually) > start working. > > Thanks, Sergey > > -----Original Message----- > From: Sergey Beryozkin > Sent: 19 July 2009 16:37 > To: '[email protected]' > Subject: RE: bad json response > > Hi > > How does the Java class representing <component/> look like ? > JSONProvider uses Jettison which is a STAX parser, so JAXB just streams > the events and jettison reacts by converting them into JSON sequences. > Perhaps some JAXB annotation confuses Jettison... > > Thanks, Sergey > > -----Original Message----- > From: Vinh Nguyen (vinguye2) [mailto:[email protected]] > Sent: 18 July 2009 20:36 > To: [email protected] > Subject: bad json response > > Hi, > I've implemented a REST service. I have data in an XML file, use > standard JAXB, and configured org.apache.cxf.jaxrs.provider.JSONProvider > in my beans.xml to convert the JAXB objects to JSON. > > But when I visually inspect the JSON response, there seems to be > name-value entries appearing like "$":"\n ". Should these be > there? I assume the XML parser used by CXF should have already stripped > out these unnecessary white spaces (i.e. carriage returns) before > passing to the JSON converter. > > My XML looks like: > > <?xml version="1.0" encoding="UTF-8" standalone="yes"?> > <component xmlns="http://xmp.cisco.com/wap/schemas/ui/Component" > xmlns:ns2="http://xmp.cisco.com/wap/schemas/ui/Tree" id="Tree"> > <properties> > <ns2:treeProperties> > <ns2:multiSelect>true</ns2:multiSelect> > <ns2:doubleClickOpen>false</ns2:doubleClickOpen> > <ns2:singleClickOpen>false</ns2:singleClickOpen> > <ns2:lazyLoad>false</ns2:lazyLoad> > </ns2:treeProperties> > <ns2:node> > <ns2:iconclass>myIconClass</ns2:iconclass> > </ns2:node> > </properties> > </component> > > The JSON response is coming as: > > {"component":{"@id":"Tree","properties":{"treeProperties":{"multiSelect" > :true,"doubleClickOpen":false,"singleClickOpen":false,"lazyLoad":false," > $":"\n "},"node":{"iconclass":"myIconClass","$":"\t\t\t > \n "}}}} > > The $ property seems to appear after each corresponding element > definition in the XML. Any idea how to get rid of these "$" properties? > On the client side, I'm using Dojo JSONPATH utils, and it's failing to > process the JSON string. > > Thanks, > -Vinh > > > -- View this message in context: http://www.nabble.com/bad-json-response-tp24551156p24590780.html Sent from the cxf-user mailing list archive at Nabble.com.
