I have a Mule ESB project where I get the data in JSON format and convert it into CSV. During the conversion, I want to replace the '&' to '/' in one of the attribute. I tried the following:
output.Department = input.department.replace('&', '/');
But mule is throwing the following error:
output.Department = input.department.replace('&', '/');" failed. (org.mule.api.expression.ExpressionRuntimeException)
org.mule.el.mvel.DataMapperExpressionLanguage:71 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/ExpressionRuntimeException.html)
4. Message: Transform failed! (org.jetel.exception.TransformException)
org.jetel.component.DataRecordTransform:132 (null)
I also tried the following variation, but all of them fail with the same error message:
output.Department = input.department.replace("&", "/");
Edit: The value for the input field 'Department' will come as something like this: 'Application & Development Team'. The target system doesn't accept '&' and that' why we need to change it to '/', so that the output value will look like 'Application / Development Team'.
My environment is Windows 7, Anypoint Studio 5.1.2 with Mule ESB EE 3.6.2 runtime and I'm running this within the Studio. Any thoughts on how to replace the ampersand (&) with slash ('/')?