AWS Step Functions - Invalid JSON Path

0

I am getting the following error when attempting to use the following JSON Path in my ResultsSelector $.Clusters[:].ClusterIdentifier.

Enter image description here

What is curious to me is that in the Step Function Data Flow simulator, the results work as expected when testing the path selection, so I am at a loss as to how to proceed.

In the end, I want to use Describe Clusters to get the data on what is running and inspect the created array to determine if my cluster of interest is running.

已提问 1 年前331 查看次数
1 回答
0
已接受的回答

Hi,

AWS Step Functions uses Amazon States Language to describe state machines declaratively, and the "@", ",", ":", and "?" operators are not supported, since all reference Paths MUST be unambiguous references to a single value, array, or object (subtree).

Thus, the wildcard symbol could be employed to select all elements of an object or array.

Step Function definition

{
  "Comment": "A description of my state machine",
  "StartAt": "Pass",
  "States": {
    "Pass": {
      "Type": "Pass",
      "End": true,
      "Parameters": {
        "clusterids.$": "$.Clusters[*].ClusterIdentifier"
      }
    }
  }
}

Input

{
  "Clusters": [
    {
      "ClusterIdentifier": 1
    },
    {
      "ClusterIdentifier": 2
    }
  ]
}

Output

{
  "clusterids": [
    1,
    2
  ]
}

I hope this helps you.

profile picture
专家
已回答 1 年前
profile picture
专家
已审核 1 年前
  • Ahh, I even scanned the spec and totally didn't pick up on that, especially since data were returned in the data flow simulator. Regardless, thank you for the note!

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则