import com.sap.gateway.ip.core.customdev.util.Message;
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
def Message processData(Message message){
def body = message.getBody(java.lang.String) as String
def jsonParser = new JsonSlurper()
def jsonObject = jsonParser.parseText(body)
message.setBody(JsonOutput.toJson(jsonObject["Root"]))
return message;
}
Eg:
Input
"Root": {
"Name": "Logu"
}
Output:
{
"Name": "Logu"
}
"Root": {
"Name": "Logu"
}
Output:
{
"Name": "Logu"
}
No comments:
Post a Comment