You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by fliot33 <fr...@poplidays.com> on 2013/11/27 04:04:22 UTC

xmljson in DSL without custom format ?

Hi,

I'm trying to use have some XML of this string
------------------------------------------------------------------------
{"info1":886,"infor2": "azesdqsd"}
------------------------------------------------------------------------
...
    <from uri="restlet:/myservice/{uid}?restletMethods=get,post" />
    <log message="step1 : ${body}"/>
    <unmarshal ref="xmljsonWithOptions"/>
    <log message="step1 : ${body}"/>					
...

    <dataFormats>
		<xmljson id="xmljson"/>
		<xmljson id="xmljsonWithOptions" forceTopLevelObject="true"
trimSpaces="true" rootName="nits" skipNamespaces="true"
removeNamespacePrefixes="true" expandableProperties="d e"/>
    </dataFormats>

But, I get :
net.sf.json.JSONException: Invalid JSON String
	at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:143)
	at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:103)

Any idea ?
Thanks in advance.



--
View this message in context: http://camel.465427.n5.nabble.com/xmljson-in-DSL-without-custom-format-tp5743879.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: xmljson in DSL without custom format ?

Posted by fliot33 <fr...@poplidays.com>.
May serve to all,
Find the answer to myself below :

... 
    <from uri="restlet:/myservice/{uid}?restletMethods=get,post" />
    <convertBodyTo type="java.lang.String" />
    <unmarshal ref="xmljson"/>
...

Regards.



fliot33 wrote
> Hi,
> 
> I'm trying to use have some XML of this string
> ------------------------------------------------------------------------
> {"info1":886,"infor2": "azesdqsd"}
> ------------------------------------------------------------------------
> ...
>     
> <from uri="restlet:/myservice/{uid}?restletMethods=get,post" />
>     
> <log message="step1 : ${body}"/>
>     
> <unmarshal ref="xmljsonWithOptions"/>
>     
> <log message="step1 : ${body}"/>
> 					
> ...
> 
>     
> <dataFormats>
> 		
> <xmljson id="xmljson"/>
> 		
> <xmljson id="xmljsonWithOptions" forceTopLevelObject="true"
> trimSpaces="true" rootName="nits" skipNamespaces="true"
> removeNamespacePrefixes="true" expandableProperties="d e"/>
>     
> </dataFormats>
> But, I get :
> net.sf.json.JSONException: Invalid JSON String
> 	at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:143)
> 	at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:103)
> 
> Any idea ?
> Thanks in advance.





--
View this message in context: http://camel.465427.n5.nabble.com/xmljson-in-DSL-without-custom-format-tp5743879p5743922.html
Sent from the Camel - Users mailing list archive at Nabble.com.