on 11-01-2018 1:30 PM
Hello Experts,
In the payload, I have character (forward slash) "/", but while converting it from XML to JSON, the sender REST adapter is appending "\" (backward slash) to it.
Need help in eliminating the "\" (backward slash) from the resulting JSON format.
XML format
<ServiceType>CPINPUSHREQ</ServiceType>
<Signature>wcIc4ooVKxfBGT0tpZJMAkIc2xEKYDrgNXvvJheeLXC2inadHGpIVQQh8N0uj3b/uEwQowOD4rIeb3zHn4in0amePt73TziUTuzeZyHO+3J5ADDs8AlJ/oYpYW5IfgRopejWSshCBXsob+7WkS1D3GLFg2L7VKumf4xz5cjTDR3vTMA7QPk6ogoe5kX0w5baJtprzNUR2K1/5P6YmWSQBUVaYOlewviAbw4BCvhCLNn67WhskPEBzRc3vqlkPK/cdX+8gsgTqOLWoBMUvaFCNwewpOSZ4gtdGwUtjx9JjWKHV40lWA6wwmay/9USx+cRgfUiID9P8Y6F2iLc7tCt6g==</Signature>
resulting JSON format
{"System":"SAPTEST","ServiceType":"CPINPUSHREQ","Signature":"wcIc4ooVKxfBGT0tpZJMAkIc2xEKYDrgNXvvJheeLXC2inadHGpIVQQh8N0uj3b\/uEwQowOD4rIeb3zHn4in0amePt73TziUTuzeZyHO+3J5ADDs8AlJ\/oYpYW5IfgRopejWSshCBXsob+7WkS1D3GLFg2L7VKumf4xz5cjTDR3vTMA7QPk6ogoe5kX0w5baJtprzNUR2K1\/5P6YmWSQBUVaYOlewviAbw4BCvhCLNn67WhskPEBzRc3vqlkPK\/cdX+8gsgTqOLWoBMUvaFCNwewpOSZ4gtdGwUtjx9JjWKHV40lWA6wwmay\/9USx+cRgfUiID9P8Y6F2iLc7tCt6g==","Payload":{"CPIN":"10341234567890","ExpDt":"20170720","TotalAmt":"200","PayerName":"abc","ChallanDtls":[{"AcntID":"101001001","Amount":"200","AdminZone":"10"},{"AcntID":"101001001","Amount":"200","AdminZone":"10"}]}}
Regards,
Sushant
Hello Guys,
This was solved using FormatConversionBean, using the below link
https://blogs.sap.com/2015/03/25/formatconversionbean-one-bean-to-rule-them-all/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shushant,
first of all, thanks for coming back and stating how you solved the issue (this is unfortunately not done by everyone, raising a question)
However, could you clarify how exactly you dealt with this problem? I'm in the same situation right now, trying to integrate with Jira and getting "\\r\\n" for carriage return / line feed.
Many thanks and kind regards
Jens
Hi,
It can be achieved by the string#replace functionality in JAVA
something like this
String noSlashes = input.replace("\\", "");
More info below in the Java documentation
Thanks,
Piyush
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Piyush,
I am working on Proxy to REST sync interface. I have few input fields which has value '/' in it ex: ( AOUS/12 and some date fields(23/04/2020).
at the JSON output payload it is coming as AOUS\/12 and dates are coming as 23\/04\/2020.
there is an addition of '\' in between. I tried to declare the field as "string" in custom xml/JSON coversion rules. but still its not working. i also tried to declare the field as "Date" in the datatype but still no luck because in the mapping its correctly populated.
the issue is coming at the REST channel while converting XML to JSON format.
Can you please help me how to get rid of this extra '\' at the channel level. if you have a JAVA mapping cod for the same, can you please share it.
thanks
Smith
Hello Experts,
Can someone please help me with a EJB or some other mechanism to handle the backslash in the payload getting added due to the conversions.
Request for prompt replies, please help.
Regards,
Sushant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sushant,
I believe you will have to use a second java mapping. Check this link below.
https://archive.sap.com/discussions/thread/3845451
Thanks,
Piyush
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sushant ,
This is the standard behavior of Jettison library used in REST adapter, this cannot be changed there is SAP note on the same which explains this.
But however when third-party converts back this JSON to XML the character gets removed so that should not be an issue.
Br,
Manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
8 | |
8 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.