1 Answer
- Newest
- Most votes
- Most comments
1
Hi,
Take a look at the following implementation example, I hope it will help you.
Code
#set($data='{ "auth":{"tenantId":"foo", "userId":"bar", "groups":"baz"}, "data" :'+$input.json('$')+'}')
#set($data=$util.escapeJavaScript($data))
{
"input" :"$data",
"stateMachineArn": "myArn"
}
Input
{
“Test”: “Test"
}
Output
{
"input" :"{ \"auth\":{\"tenantId\":\"foo\", \"userId\":\"bar\", \"groups\":\"baz\”}, \”data\”: { \”Test\":\”Test\”}}",
"stateMachineArn": "myArn"
}
Relevant content
- asked a year ago
- Accepted Answerasked 8 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
Thanks Mikel, that works! Didn't know that I can just concatenate my json string that way. There is no way to convert my VTL object to a json string?
Unfortunately the $util variable does not contain a utility functions for that, and I don't know if there is any other elegant way.