on 2020 Sep 16 8:43 AM
Hi All,
I am passing a Json payload to CPI. Value is changing for integer so i want to replace that in CPI using groovy script.
Payload coming into CPI is :
{ "Name" : "Unhappy Customer Survey Feedback Response", "BuyerPartyID" : "\"1049913\"", "DataOriginTypeCode" : "\"4\"", "ServicePriorityCode" : "\"1\""}
want to change it in CPI like:
{ "Name" : "Unhappy Customer Survey Feedback Response", "BuyerPartyID" : "1049913", "DataOriginTypeCode" : "4", "ServicePriorityCode" : "1"}
below is the groovy script which I am using.
Please help me to resolve this issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Toushif,
I am testing the string in groovy console then its working. If i am passing payload { "Name":"Unhappy Customer Survey Feedback Response", "BuyerPartyID":"\"1049913\"", "DataOriginTypeCode":"\"4\"", "ServicePriorityCode":"\"1\"" } in CPI then I am getting error. I am new to this and dont know how to write script, so my script is not working in CPI.
Thank You Toushif. it helped and working fine now 🙂
Hi ayushtiwari,
I think you should use replace on variable body at one go.
body = body.replaceAll('\"','')
And then parse it later.
Hope this helps !
thanks and regards,
Praveen T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
62 | |
10 | |
7 | |
7 | |
6 | |
6 | |
6 | |
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.