Home > Blockchain >  JSONPath expression works with Data flow simulator but not with step functions
JSONPath expression works with Data flow simulator but not with step functions

Time:11-23

I'm trying to use the InputPath filter in AWS Step Functions to select a portion of the JSON state input to use with a JSONPath expression.

Data

[
  {
    "ticker": "DE30_EUR",
    "granularity": "M"
  },
  {
    "ticker": "DE30_EUR",
    "granularity": "W"
  },
  {
    "ticker": "DE30_EUR",
    "granularity": "D"
  },
  {
    "ticker": "DE30_EUR",
    "granularity": "H1"
  }
]

Current JSONPath expression

$[?(@.granularity==H1),?(@.granularity==D),?(@.granularity==W)]

This works when using the AWS Step Functions Data flow simulator with the data above and only returns array items with granularity of "H1", "D" or "W".

Issue

However, when using this with step functions as the InputPath or OutputPath it returns an empty array which is not the same as the Data flow simulator.

CodePudding user response:

Try the below JSONPath

$[?(@.granularity=='H1'|| @.granularity=='D' || @.granularity=='W')]
  • Related