cancel
Showing results for 
Search instead for 
Did you mean: 

SAP XI/PI/PO Remove invalid start name character REST Adapter JSON/XML Fieldname

0 Kudos
2,635

Dear community,

I am currently developing an interface in SAP PI which should proivde an ABAP Proxy to consume a JSON REST service. I made all the configuration and setup in PI and now have following issue.

The REST JSON Service returns a JSON with a fieldname called "_LINKS". In the REST Adapter I configured that the JSON Format should be converted to XML and I get following result:

Now, as I prepared my datatype for the ABAP Proxy, I get the error that the fieldname is not allowed to have a "_" as first character:

Question now, is it possible to remove the "_" from the XML to be able to map it to a valid fieldname in the datatype?

I found following option in the REST Adapter und Parameters > Data Formats > Response:

"Escape invalid name start character":

But I don't know how to use it. I started to provide the character "_" in the Escape Sequence, but the result is that for every fieldname which start with the character "_" it adds another "_" character to it:

At first I was confused why it added the character, so I thought I need to enter a character which should be allowed as a valid first character. But entering characters like "a" or "z" did nothing and where not added. I only found out that when I added "s" that the fieldname "self" was added another "s" character:

So I don't know if I use this option properly. This SAP Support Note metions this option as new feature but does not provide a documentation on how to use this option properly:

2083009 - NF: JSON to XML conversion enhancements

Is there any otherway to be able to use the field "_links" or to map it properly?

Thanks for everyone for reading and for any help.

BR,

Andreas

View Entire Topic
former_member190293
Active Contributor

Hi!

I've never tried it myself, but what if to use:

Regards, Evgeniy.

Hello Evgeniy,

thank you so much for your time and help.

I feel absolutely stupid as I found this option "Convert JSON Name To XML Name" but I didn't saw that this mapping table was displayed at the end so I had to scroll. With that maintained I could remove the _ from the request:


Thanks you so much.

BR,

Andreas