cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PI 7.31 REST – XML to JSON. Modify tag after convert to Json

thiago_labres1
Explorer
0 Kudos

Hi,

I need modify the name of tag after Json conversion in SAP PI 7.31

In the XML the tag name is <AF1>, <AF2>…. But in Json the tag is “1”, “2”….

XML does’nt work the tag with a number (<1>, <2>…)

XML:

<userid>123456</userid>
 <email>test@test</email>
 <password>123456789</password>
 <additional_fields>
  <AF1>Campo 1</AF1>
  <AF1>Campo 2</AF2>
 </additional_fields>

Converted JSON:

{"userid":"123456",
  "email":"test@test",
  "password":123456789,
  "additional_fields":
  {
  "AF1":"Campo 1",
  "AF2":"Campo 2"
  },
  }

expected JSON:

{"userid":"123456",
  "email":"test@test",
  "password":123456789,
  "additional_fields":
  {
  "1":"Campo 1",
  "2":"Campo 2"
  },
  }

Is there any way to change the tag name after generating Json? or create a tag with a number in tag name in the XML?

Accepted Solutions (1)

Accepted Solutions (1)

thiago_labres1
Explorer

Hi,

The solution is add in Communication Channel the check box "Remove escaped name start character" and add "Escape sequence" "AF". Added print.

solution.png

Answers (0)