cancel
Showing results for 
Search instead for 
Did you mean: 

JSON to XML

shabbir_mohmad
Participant
0 Kudos

Hi Experts,

I have a scenario like below:

SAP --> PI  --> 3rd party (REST )

Requirement is once thirdparty receives request from PI, it sends response(JSON message) in encrypted format.

I need to decrypt my response and againa want to convert that to xml and send back to SAP

For decrypting, i already have a java code.

Response Json strucutre looks:

For successful response:

[{

“serviceName” : ”xxxxx”,

“function” :  “aaaa”,

“responseStatus” : ”Success” ,

“errorMessages” : “”

“results” :

[{

  "Name":"xxxx",

  "SNO":"xxxx",

  "Type":"cccc",

  "TailNumber":"ccc",

  "RegNumber":"",

  "Fleet":"a12w"},

  

  ......

}]

For failed response :

[{

“serviceName” : ”xxxx”,

“function” :  “aaaa”,

“responseStatus” : ”failure” ,

“errorMessages” : “Reason for failure”

“results” : []

}]

I have 2 ideas:

1. write a module bean to decrypt and converto to xml

2. read response as a string and using java mapping, convert that to xml

I have little knoeledge on Java, so requesitng some experts help.

Regards,

SP

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi SP

If you are using REST Adapter, then you have option in channel itself to convert json to xml.

Since your response is decrypted, not sure it will work. But still you can give it a try.

You can also check this module in the below link. This might be helpful to you.

check this also.

Regards

Osman