Extract all particular field from JSON in mule esb
You need to transform the message's streaming payload to an object with:
<json:json-to-object-transformer returnClass="java.lang.Object" />
before the enricher
, and remove the one you have inside of it.
You also need to fix your MEL, as the listings
property is missing in it:
source="#[(externalListingId in payload.listings.listing)]"
it worked with the same definition.
<flow name="test-mule-json-extractFlow"> <http:listener config-ref="HTTP_Listener_Configuration" path="/json" doc:name="HTTP"/> <enricher source="#[(externalListingId in payload.listings.listing)]" target="#[flowVars.ids]" doc:name="Message Enricher"> <json:json-to-object-transformer returnClass="java.util.HashMap" doc:name="JSON to Object"/> </enricher> <logger message=":::::::::::::::#[flowVars.ids]" level="INFO" doc:name="Logger"/> </flow>
Note: the json input you mentioned is not valid due to available of an extra comma.