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
