问题
I have a payload like
{"jcr:createdBy":"admin","jcr:content":{"sling:resourceType":"contentpage","addressdetails":{"state":"vic"}}}
I want to change the value of state. I have tried the below,
<expression-transformer
expression="#[message.payload.jcr:content.addressdetails.state = 'NSW';message.payload]"
doc:name="Expression" />
but this throws an exception, invalid expression. I believe its because of : in jcr:createdBy. How should I handle this?
回答1:
Try <json:json-to-object-transformer returnClass="java.util.HashMap" />
before expression like following :-
<json:json-to-object-transformer returnClass="java.util.HashMap" />
<expression-transformer expression="#[message.payload.jcr.content:addressdetails.state = 'NSW';message.payload]" doc:name="Expression" />
来源:https://stackoverflow.com/questions/26052989/mule-expression-transformer-exception