mule expression transformer exception

爷,独闯天下 提交于 2020-01-07 08:31:09

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!