Parse the List of objects in AWS Connect

回眸只為那壹抹淺笑 提交于 2019-12-13 03:57:17

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!