Reputation: 11
i am using payloadfactory mediator and adding single slash value in arg but ESB is converting it into double slash below is the payloadfactory which in using along with response
<payloadFactory media-type="json">
<format>
{
"channel": {
"text": "this is test Text $1"
}
}
</format>
<args>
<arg evaluator="xml" value="\n" />
</args>
</payloadFactory>
Payload is set to
{
"channel": {
text": "this is test Text \\n"
}
}
and i want.
{
"channel": {
"text": "this is test Text \n"
}
}
P.S "\n" will be set above in property mediator and i will put it in payload factory through arg, thats why i cannot use it in format directly.
Thanks.
Upvotes: 1
Views: 375
Reputation: 3459
It seems to be a limitation in the ESB. Please try the following workaround. (Yeah I know. It seems like an overkill)
<enrich>
<source type="inline" clone="true">{
"replace" : "\n"
}</source>
<target type="body"/>
</enrich>
<property name="NEW_LINE" expression="json-eval($.replace)" scope="default" type="STRING"/>
<payloadFactory media-type="json">
<format> {
"channel": {
"text": "this is test Text $1"
}
}
</format>
<args>
<arg literal="true" evaluator="xml" expression="$ctx:NEW_LINE"/>
</args>
</payloadFactory>
Upvotes: 1