mule getting data from json payload

TechFind picture TechFind · Dec 4, 2014 · Viewed 13.6k times · Source

My payload is

<json:json-to-object-transformer returnClass="java.lang.Object" doc:name="JSON to Object"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>`

which prints ( this is the json array input given)

[{"Name":"My name","Address":"add1","Location":"NY"}]

Now, I need to get data from the payload:

<logger message="#[payload.Name]" level="INFO" doc:name="Logger"/>

it prints null. How do I get data from the payload using MEL? Is there any simpler way of getting in Groovy or xpath?

EDIT

Passed single json data as:

{"Name":"My name","Address":"add1","Location":"NY"}

logger:

  <logger message="#[payload.Name]" level="INFO" doc:name="Logger"/>

it prints null value.

Answer

Daniel De Le&#243;n picture Daniel De León · Sep 17, 2015

In Mule ESB 3.7.0

This work:

#[json:Name]