rest dsl json contains escape sequence

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

rest dsl json contains escape sequence

contactreji
Hi Guys

I was just doing some POC on rest dsl. I have my route like this

 rest("/test")
                .produces("application/json")
                .consumes("application/json")
                .put().type(APIRequest.class)
                .to("direct:processRequest");


 from("direct:processRequest").log("Received  Request data ${body}")
                .marshal(requestFormat)
                .setHeader(Exchange.HTTP_METHOD, constant("POST"))
                .setHeader("Content-Type", constant("application/json"))
                .log(" request - ${body}")
                .to("{{ServiceUrl}}?throwExceptionOnFailure=false")
                .convertBodyTo(String.class)
                .setProperty("responseData",simple("${body}"))
                .setBody(simple("${property.responseData}"))
                .log("API Response - ${body}")
                //I dont want to do any unmarshalling to any object here. Just want to pass string bank
                .transform(simple("${body}"))
                .removeHeaders("*")
                .setHeader(Exchange.HTTP_RESPONSE_CODE, constant(200))
                .end();

My response contains a lot of escape sequence before every quote. Check the response snippet below

 "{\"Response\":{\"Error\":{\"ErrorCode\":0,\"ErrorMessage\":\"\"}

Is there  a way I can relay back the same json i received from api call back to my http client? Need to avoid the back slashes here.

Reji Mathews
Sr. Developer - Middleware Integration / SOA ( Open Source - Apache Camel & Jboss Fuse ESB | Mule ESB )
LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a
Twitter - reji_mathews
Loading...