dpjjmo3079 2016-06-16 15:39
浏览 51

从多个数组中提取值

I'm currently using the Adobe Echosign API to format some data in a table. The output looks like this:

{
  "agreementId": "",
  "events": [
    {
      "actingUserEmail": "",
      "actingUserIpAddress": "",
      "date": "date",
      "description": "",
      "participantEmail": "",
      "type": "",
      "versionId": ""
    }
  ],
  "locale": "",
  "modifiable": false,
  "name": "",
  "nextParticipantSetInfos": [
    {
      "nextParticipantSetMemberInfos": [
        {
          "email": "",
          "waitingSince": "date"
        }
      ]
    }
  ],
  "participantSetInfos": [
    {
      "participantSetId": "",
      "participantSetMemberInfos": [
        {
          "email": "",
          "participantId": ""
        }
      ],
      "roles": [
        ""
      ],
      "status": ""
    }
  ],
  "status": "",
  "vaultingEnabled": false
}

I'm looping through multiple agreements and this outputs them each as a separate array.

This is probably a really basic question, but how would I go through each array and extract say the 'participantEmail', 'name' and 'status' values?

Thanks!

  • 写回答

2条回答 默认 最新

  • douya6606 2016-10-18 13:38
    关注

    Depending on what programming language you are using, there are a lot of ways to handle this. In JS you could convert this JSON array into JS Array of Objects and after that you can access them using JS processing.

    Example for JS would be:

    var input = 'yourJSONstring';
    var jsObject = JSON.parse(input);
    for(var foo in jsObject){
        var name = foo.name;
        var participantEmail=  foo.events[0].participantEmail;
        var status = foo.participantEmail[0].status;
    }

    </div>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 有人能看一下我宿舍管理系统的报修功能该怎么改啊?链表那里总是越界
  • ¥15 cs loadimage运行不了,easyx也下了,没有用
  • ¥15 r包runway详细安装教程
  • ¥15 Html中读取Json文件中数据并制作表格
  • ¥15 谁有RH342练习环境
  • ¥15 STM32F407 DMA中断问题
  • ¥15 uniapp连接阿里云无法发布消息和订阅
  • ¥25 麦当劳点餐系统代码纠错
  • ¥15 轮班监督委员会问题。
  • ¥20 关于变压器的具体案例分析