如何将对象数组的值作为输入传递给步骤函数输入?

huangapple go评论69阅读模式
英文:

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

问题

我有一个阶梯函数输出,格式如下:
[{
"status" : "VALIDATION_FAILED",
"memberData":{
"metaData" : {
"fileId" : 101,
"FileName" : "abc.txt"
}
}
}]

现在我只想将 metaData 作为输入传递给步骤函数的下一步。
通常我们通过使用 inputPath: $.status 等方式访问数据。但我怀疑,由于存在 [ ],它给我一个错误:
' 无效路径 '$.status' :在路径 $ 中未找到属性 ['status']。

由于同样的原因,我无法访问任何变量。请问有人能指导我如何解决这个问题吗?

我找到了一些解决方案,但没有找到我需要的。

英文:

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

答案1

得分: 1

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

英文:

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

huangapple
  • 本文由 发表于 2023年6月25日 19:40:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/76550215.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定