Reputation: 659
I have two step functions that run in third one(nested step functions). When first one finishes it creates JSON with a lot of key value information. I want to use this JSON as is in next step function. Currently, output from first step function is escaped string. Is there any nice way to do this, without executing lambda to parse this escaped json string?
Upvotes: 2
Views: 1253
Reputation: 1
We can remove the escape string by converting the output of your step in ResultSelector using "States.StringToJson($), where $ is your output JSON.
This removes escape chars and returns the JSON object.
Hope this helps. For details refer to the Intrinsic Functions
Upvotes: 0
Reputation: 13956
You can use :2
option when you invoke second step function. That will return a json instead of escape string.
{
"Type":"Task",
"Resource":"arn:aws:states:::states:startExecution.sync:2",
"Parameters":{
"Input":{
"Comment": "Your input goes here",
"AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID.$": "$$.Execution.Id"
},
"StateMachineArn":"arn:aws:states:us-east-1:123456789012:stateMachine:NestedStateMachine",
"Name":"ExecutionName"
},
"End":true
}
Source: https://docs.aws.amazon.com/step-functions/latest/dg/connect-stepfunctions.html
Upvotes: 0
Reputation: 7404
You could
I would go with 2. considering single responsibility principle, but if you want to avoid another lambda invocation, go with 1. or 3.
Upvotes: 1