ESB WSO2 Java - I want to modify a value from a json file with Class Mediator
So I have this Class Mediator for my API:
public class CheckUser extends AbstractMediator {
public boolean mediate(MessageContext context) {
String age_value = (String) context.getProperty("age_value");
context.setProperty("age_value", 33);
log.info("#### The new age value is: " + context.getProperty("age_value"));
return true;
}
}
And I want to modify the age value in the response
Initial json file:
{
"data": {
"user": {
"name": "Andrei",
"adress": "Tudor Vladimirescu, nr2",
"cnp": 123456789,
"age": 22,
"valid": "Yes"
}
}
}
Desired json file:
{
"data": {
"user": {
"name": "Andrei",
"adress": "Tudor Vladimirescu, nr2",
"cnp": 123456789,
"age": 33,
"valid": "Yes"
}
}
}
Thank you!
Comments
Post a Comment