Skip to content

bug: StepFunctions JSONPath wildcard/slice evaluation against dictionaries #12960

@andrewmaye

Description

@andrewmaye

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

There is a discrepancy between how AWS deals with wildcard/slice evaluation of a JSONPath expression and how localstack is handling the same expression.

For example, the following SFN definition:

{ "Comment": "JSON_PATH_ARRAY_ACCESS", "StartAt": "EntryState", "States": { "EntryState": { "Type": "Pass", "Parameters": { "item.$": "$[*]" }, "End": true } } }

when run in an AWS account with this input

{ "p1": "v1", "p2": "v2" }

Gives the following output:

{ "item": [ "v1", "v2" ] }

Image

So, we can see that the output array contains the values from the dictionary object passed in as input.

However, when run in localstack:

╭─mayea@KMHQXXFP73 ~ ╰─➤ awslocal stepfunctions create-state-machine --name "test" --definition '{ "Comment": "JSON_PATH_ARRAY_ACCESS", "StartAt": "EntryState", "States": { "EntryState": { "Type": "Pass", "Parameters": { "item.$": "$[*]" }, "End": true } } }' --role-arn 'dummy' { "stateMachineArn": "arn:aws:states:eu-west-2:000000000000:stateMachine:test", "creationDate": "2025-08-06T08:33:21.878304+01:00" }

Started with input:

╭─mayea@KMHQXXFP73 ~ ╰─➤ awslocal stepfunctions start-execution --state-machine-arn "arn:aws:states:eu-west-2:000000000000:stateMachine:test" --input '{"p1": "v1", "p2": "v2" }' { "executionArn": "arn:aws:states:eu-west-2:000000000000:execution:test:42e821b0-2672-4d53-9e69-47ec64f8ce9a", "startDate": "2025-08-06T08:34:32.763827+01:00" }

Gives output:

╭─mayea@KMHQXXFP73 ~ ╰─➤ awslocal stepfunctions describe-execution --execution-arn "arn:aws:states:eu-west-2:000000000000:execution:test:42e821b0-2672-4d53-9e69-47ec64f8ce9a" { "executionArn": "arn:aws:states:eu-west-2:000000000000:execution:test:42e821b0-2672-4d53-9e69-47ec64f8ce9a", "stateMachineArn": "arn:aws:states:eu-west-2:000000000000:stateMachine:test", "name": "42e821b0-2672-4d53-9e69-47ec64f8ce9a", "status": "SUCCEEDED", "startDate": "2025-08-06T08:34:32.763827+01:00", "stopDate": "2025-08-06T08:34:33.020927+01:00", "input": "{\"p1\":\"v1\",\"p2\":\"v2\"}", "inputDetails": { "included": true }, "output": "{\"item\":[{\"p1\":\"v1\",\"p2\":\"v2\"}]}", "outputDetails": { "included": true } }

i.e. the output when using localstack outputs the full object, keys and values

Expected Behavior

local stack output to match AWS output, i.e. rather than outputting

{ "item": [ { "p1": "v1", "p2": "v2" } ] }

It should output

{ "item": [ "v1", "v2" ] }

How are you starting LocalStack?

With a docker run command

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

docker run --rm --name "localstack-main" -p 4566:4566 localstack/localstack:4.7.0

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

awslocal stepfunctions create-state-machine --name "test" --definition '{ "Comment": "JSON_PATH_ARRAY_ACCESS", "StartAt": "EntryState", "States": { "EntryState": { "Type": "Pass", "Parameters": { "item.$": "$[*]" }, "End": true } } }' --role-arn 'dummy'

awslocal stepfunctions start-execution --state-machine-arn "arn:aws:states:eu-west-2:000000000000:stateMachine:test" --input '{"p1": "v1", "p2": "v2" }'

awslocal stepfunctions describe-execution --execution-arn "<execution-arn>"

Environment

- OS: MacOS Sequoia 15.5
- LocalStack:
  LocalStack version: 4.7.0
  LocalStack Docker image sha: sha256:ad4f76a02108f52479a33bbe0de40690d63ef51713971731f21f1de1e4eedb85
  LocalStack build date: 2025-07-31
  LocalStack build git hash: 82de91e30

Anything else?

I also created this integration test to show some other differences between AWS and localstack

#12959

Also, this is probably related to this bug which was fixed a few months ago: #12318

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions