You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by contactreji <co...@gmail.com> on 2017/01/11 11:55:44 UTC
rest dsl json contains escape sequence
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
--
View this message in context: http://camel.465427.n5.nabble.com/rest-dsl-json-contains-escape-sequence-tp5792390.html
Sent from the Camel - Users mailing list archive at Nabble.com.