groovy - Extract all particular field from JSON in mule esb -


i have json payload, want collect externallistingid in 1 shot -

{ "listings": {     "numfound": 3,     "listing": [         {             "status": "inactive",             "priceperticket": {                 "amount": 100,                 "currency": "usd",             },             "paymenttype": "1",             "externallistingid": "12208278",             "city": "new york"         },         {   "status": "active",             "priceperticket": {                 "amount": 4444,                 "currency": "usd"             },             "paymenttype": "1",             "externallistingid": "cid1421798897102:151681733",             "city": "seattle"         }       ]    } } 

i using mvel expression -

<enricher target="#[flowvars['sdata']]" source="#[(externallistingid in payload.listing)]" doc:name="message enricher">     <json:json-to-object-transformer returnclass="java.util.hashmap" doc:name="json object"/>     </enricher> 

but giving error !! - message payload of type: releasinginputstream.

scenario - collect externallistingid flowvariable, convert hashmap. have csv file input, loop through payload , check if map contains id!!

i following earlier post - extracting array json in mule esb

you need transform message's streaming payload object with:

<json:json-to-object-transformer returnclass="java.lang.object" /> 

before enricher, , remove 1 have inside of it.

you need fix mel, listings property missing in it:

source="#[(externallistingid in payload.listings.listing)]" 

source: http://www.mulesoft.org/documentation/display/current/mule+expression+language+tips#muleexpressionlanguagetips-jsonprocessing


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -