Question

I have an inbound payload in JSON format. I'm converting it using the "JSON to Object" converter, and then passing on the data to a component (as a JsonData object.) My component then returns the same JsonData object with modifications. I'm trying to use the Amazon S3 component as the next step in my flow, and trying to tie the bucket name and other values to elements accessible in the JsonData object. Here is the expression for the bucket name for instance:

#[json: TopKey/BucketName]

From experience this has worked with JSON.

However when I run this, here is what I get:

Message : Failed to invoke getObjectContent. Message payload is of type: JsonData Code : MULE_ERROR-29999

  1. Failed to invoke getObjectContent. Message payload is of type: JsonData (org.mule.api.MessagingException) org.mule.module.s3.processors.GetObjectContentMessageProcessor:177 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)

Is there a way I can use my JsonData object and pull information from it, or do I have to convert it back to something else before passing it on to the Amazon S3 component?

Thanks,

Was it helpful?

Solution 2

Remove the empty space from your expression: #[json:TopKey/BucketName]

OTHER TIPS

After trying a little more to play with my expression, I figured out I can just access elements the way I do it in my Java component already:

#[payload.get("TopKey").get("BucketName").getTextValue()]

and I have my BucketName!

You can set the "Return Class" to java.util.Map in the "JSON to Object" processor, you can then access the value via #[payload.TopKey.BucketName]

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top