cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot transform JSON document to XML: JSON document does not start with '{'.

2,993

Hi experts,

I have an issue in CPI using the JSON to XML converter, I tried to use it and CPI response me the next message: com.sap.it.xmljson.JsonXmlException: Cannot transform JSON document to XML: JSON document does not start with '{'.

I have the following JSON body that I need to convert to XML

I know the problem is [ at the beginning of the body. My question is, how can I remove that symbol to be able to use the JSON to XML converter?

I appreciate your answers

greetings

View Entire Topic
RobertQ
Explorer

Hello Sara,

this is a limitation from the Json to XML Converter as stated in the documentation.

You can simply add a content modifier as described their and process the message.

Here an example with a simulation. I also had to add a second "root" element as their is alos a limitation that the root Object can only have one member. So I added a second root (the name can be adjusted in the Converter).

Content Modifier:

JSON to XML Converter:

Simulation Body input:

Simulation Body Middle:

Simulation Body End:

I hope this helps you with your issue.

Best Regards

Robert

0 Kudos

Hi Robert,

Your solutions works,

Thanks for your help

RobertQ
Explorer
0 Kudos

Hello jaimestrada,

if the solution works, please mark my answer as accepted, so other peaople can find this solution more easily.

Best Regards

Robert