问题
AWS lambda returns the below List. How can I parse the List in AWS Connect? In AWS Connect, if lambda returns a single attribute (customerId) I can parse that value in Connect using $.External.customerId and was able to play that CustomerId.
If Lamda returns the below List, I was accessing in connect as: $.External.list.CustomerId and it fails. No errors n Cloudwatch Logs. Any idea how to parse the below list in Connect?
AWS lambda returns the below List. How can I parse the List in AWS Connect? In AWS Connect, if lambda returns a single attribute (customerId) I can parse that value in Connect using $.External.customerId and was able to play that CustomerId.
If Lamda returns the below List, I was accessing in connect as: $.External.list.CustomerId and it fails. No errors n Cloudwatch Logs. Any idea how to parse the below list in Connect?
{
"list": [
{
"CustomerId": 224455,
"CustName": "John"
},
{
"CustomerId": 334455,
"CustName": "Peter"
}
]
}
{
"list": [
{
"CustomerId": 224455,
"CustName": "John"
},
{
"CustomerId": 334455,
"CustName": "Peter"
}
]
}
I should be able to parse in Connect as: $.External.list.customerId and $.External.list.custName
回答1:
You will need to specify the index for the element you are accessing in the list.
$.External.list[0].customerId
This is using JSONPaths https://support.smartbear.com/alertsite/docs/monitors/api/endpoint/jsonpath.html
来源:https://stackoverflow.com/questions/55437802/parse-the-list-of-objects-in-aws-connect