Neil
Neil

Reputation: 19

How to give values with array of objects as input to a step function input?

I have a step function output in the below format: [{ "status" : "VALIDATION_FAILED", "memberData":{ "metaData" : { "fileId" : 101, "FileName" : "abc.txt" } } }]

Now I only want to give metaData as input to the next step in my step function. Usually we access the data by using inputPath: $.status and so on. But I suspect, due to the presence of [ ], it's giving me an error of ' Invalid path '$.status' : Property ['status'] not found in path $.

I m unable to access any variable inside for the same reason. Can anyone please guide on how do I address this?

I came across some solutions but didn't get what I m looking for

Upvotes: 1

Views: 2462

Answers (1)

aadel
aadel

Reputation: 884

A filter expression similar to the following can be used given the output above:

$[0].memberData.metaData

Ref: https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-paths.html

Upvotes: 1

Related Questions