Monday 3 December 2018

XML to JSON convertor -Double quoted removed in integer

If you need to convert Integer to JSON Integer, it's recommended to put a script module right after the XML to JSON Converter.

In the script module, you can handle the JSON result as in integers are removed with double quotes

Groovy Script:

import com.sap.gateway.ip.core.customdev.util.Message;

def Message processData(Message message) {

def body = message.getBody(java.lang.String) as String;

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

message.setBody(output);

return message;

}



No comments:

Post a Comment