cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

XML to JSON conversion issues with Boolean and Double data types

amallick
Participant
4,555

Hello Experts,

I'm trying to use the standard XML to JSON Converter on the Cloud Platform Integration iFlow, but facing the following challenges:

1. In traditional PO environment when we use the REST receiver adapter and do the XML to JSON conversion, it does not add double quotes (" ") around Boolean data types, but the Cloud Integration converter is treating all data types as strings.

2. Again in traditional PO environment we could provide the default values in the adapter XML/JSON conversion rules, like following:

But I couldn't find a place in the Cloud Integration converter to do the same and it's also double quotes around Decimal/Double data types, like:

I feel a need to use a Groovy script, but I'm not an expert and there are not good documentation available on the internet today. I looked into SAP note 2521044 and tried using the sample groovy attached to it, but received the following error:

Looking forward to the experts to help me resolve it.

Thank you,

Anirban

Accepted Solutions (1)

Accepted Solutions (1)

MortenWittrock
SAP Mentor
SAP Mentor

Hi Anirban

As you've discovered, the XML to JSON converter in CPI doesn't have a lot of functionality at this point. As mentioned in the note, all values are treated as strings, even though all values are not strings, obviously.

For now, you will have to clean up the JSON with a Groovy script. I don't see a problem with the sample script attached to the note.

I would suggest that you try and update the script yourself. If it doesn't work out, post a new question and include the script code, a sample of the JSON you want to clean up and what it should look like after it's been cleaned up. Post everything as text, please, for easier copy-pasting (i.e. not images).

Regards,

Morten

amallick
Participant
0 Likes

Hi Morten,

Thanks for the comment, I opened a new question with the details and closing this thread.

Regards,

Anirban

Answers (0)