cancel
Showing results for 
Search instead for 
Did you mean: 

REST Adapter XML to JSON conversion adding escape character '\' to string containing charater '/'

Former Member

Hello gurus,

The receiver REST adapter adds up an escape character to the string after converting the xml data to JSON format. I also tried providing the value as string in the 'custom XML\JSON Conversion Rules table'. But the character is still getting added up. Could you please help.

string in XML: application/vnd.abc.remision_5.2+xml

string after conversion to JSON: application\/vnd.abc.remision_5.2+xml

Thanks,

Pankaj

former_member223432
Participant
0 Kudos

HI, Could you please let me know how you fixed this issue?

Regards

Smith

Accepted Solutions (0)

Answers (2)

Answers (2)

JaySchwendemann
Active Contributor
0 Kudos

Works as designed, I'm afraid https://launchpad.support.sap.com/#/notes/2482060 even if the jettison library supports at least omiting the forward slash escaping, see https://www.mvndoc.com/c/org.codehaus.jettison/jettison/org/codehaus/jettison/json/JSONArray.html#se...

Bummer that SAP just doesn't fork that darn library and makes a module parameter so we can omit escaping for forward slashes or even completely.

former_member198060
Participant
0 Kudos

Hello Jens, unfortunately I cannot view the note you are refering to. Any chance for you to share the contents here?

I am guessing that we could use a custom AM to do the JSON conversion in order to work around this limitation, right?

JaySchwendemann
Active Contributor
0 Kudos

I, too do not have access to the note anymore. Might be some temp issue or SAP trying to hide from its guilt 😉

From the top of my mind the note was something in the line of "we use jettison library for the XML <=> JSON conversion" and esaping is works as designed.

I myself had some access to the endpoint system (being Jira server) and we worked around the issue by applying some logic to fix the escaping wihtin Jira after the API call.

You could also have a look at engswee.yeoh 's bean to "rule them all" --> https://blogs.sap.com/2015/03/25/formatconversionbean-one-bean-to-rule-them-all/

Cheers

Jens

Former Member
0 Kudos

is it creating any errors ? if not, use mapping functions to remove it.

Best,

Vibhu

JaySchwendemann
Active Contributor
0 Kudos

The escape character will be inserted within the module of the REST adapter. Mapping comes probably a little late to the party. Some string-replace-bean migth do the trick though