When using JSONPath, I knew how to combine input to some task(for instance lambda) and just add the result to additional property. For instance:
{
"input_1" : "value_1",
"input_2" : "value_2
}
and after invoking lambda function, I would get(using ResultPath):
{
"input_1" : "value_1",
"input_2" : "value_2,
"lambda_result" : "value_3"
}
How can I achieve this using JSONata?
With JSONata in Step Functions, the Output
must contain all required properties explicitly. You can achieve this with a JSONata $merge
:
{%
$merge([$states.input, {
"lambda_result": $states.result.Payload
}])
%}