Reputation: 191
I have a lambda integrated with API gateway (Proxy Integration)
Lambda returns :
collection = [
{
"name": "string1"
},
{
"name": "string2"
}
]
response = {
'statusCode': 200,
'body': JSON.stringify(collection)
}
return response
This works fine because in Proxy Integration body needs to be a string. If I dont convert the JSON array into string, API gateway throws 502 gateway error. So I need to convert it into string.
Now, Im planning to use same lambda for AWS Step function where a map needs JSON array as input.
How do I convert this stringify-ed JSON array to normal array for Map to process?
I have tried to use States.StringToJson
Old:
New:
I get invalid JSONPath format error.
Upvotes: 0
Views: 1374
Reputation: 191
Along with Jason answer following documentation helped
https://states-language.net/spec.html#intrinsic-functions
Upvotes: 0
Reputation: 8885
You can use the States.StringToJson intrinsic function to convert the string to JSON.
Upvotes: 1