cancel
Showing results for 
Search instead for 
Did you mean: 

SAP HCI XML to JSON Converter

Krishneel
Participant
0 Kudos

Hi Experts,

In my HCI iFlow I'm using the XML to JSON Converter. It works fine for String values however for integer values it also puts quotes around the value. For example: {"Value":"20161212"}

However what I need is: {"Value":20161212} i.e. without the quotes around the integer value.

Is there anyway I can remove these quotes?

Thanks,

Krishneel

Accepted Solutions (0)

Answers (2)

Answers (2)

juanancardenas
Explorer
0 Kudos

Dear all.

See below for double or float values:

String output = input.replaceAll("\"(\\d+\\.?\\d+?)\"", "\$1");

Regards.

Juan.

engswee
Active Contributor
0 Kudos

Hi Krishneel

From the online help library below, it mentions that all XML elements/attributes are transformed to a JSON String. So I don't think you can configure the converter to handle integer values.

SAP HANA Cloud Integration (External)

An alternative would be to use a Groovy script after the converter to "clean" up those fields that are integer only. You can use the String class' replaceAll method to locate and replace those fields using Regex - sample usage below


String output = input.replaceAll("\"(\\d+)\"", "\$1");

Rgds

Eng Swee