-1

Description:

I am using AWS Step Functions and need to process an input JSON that looks like this:

{
  "id": "123456",
  "bubble": [
    {
      "type": "flex",
      "altText": "001"
    },
    {
      "type": "flex",
      "altText": "002"
    }
  ]
}

My goal is to iterate over the bubble array while keeping the id field in each mapped output. The expected results should be:

1.

{
  "id": "123456",
  "bubble": {
    "type": "flex",
    "altText": "001"
  }
}
{
  "id": "123456",
  "bubble": {
    "type": "flex",
    "altText": "002"
  }
}

How can I achieve this transformation using AWS Step Functions and Map state? Any guidance on the state machine definition or JSONPath would be appreciated.


1 Answer 1

0

I think you can use an ItemSelector inside the Map to get what you want: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-itemselector.html

{
  "ItemSelector": {
    "id.$": $.id,
    "bubble.$": "$$.Map.Item.Value"
  }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.