azure - 需要在 azure 逻辑应用程序中使用表达式才能获取 JSON 元素

标签 azure azure-devops azure-logic-apps

我的逻辑应用程序中有一个 JSON 内容。我需要从 JSON 中仅获取特定元素(commitId 的值),而不是所有属性。你能帮我写一个合适的表达方式吗?

{
  "count": 1,
  "value": [
    {
      "commitId": "zzzzzzzzzzzzzzzzzzzz",
      "author": {
        "name": "mahesh",
        "email": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="630e020b06100b231b1a194d000c0e" rel="noreferrer noopener nofollow">[email protected]</a>",
        "date": "2020-03-27T09:43:03Z"
      },
      "committer": {
        "name": "mahesh",
        "email": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="385559505d4b5078404142165b5755" rel="noreferrer noopener nofollow">[email protected]</a>",
        "date": "2020-03-27T09:43:03Z"
      },
      "comment": "Added task markdown file.",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "changes": [
        {
          "sourceServerItem": "/Books",
          "changeType": "edit"
        }
      ],
      "url": "https://dev.azure.com/company/aaaabbbbbbb/_apis/git/repositories/ccccddddd/commits/eeeeeefffff",
      "remoteUrl": "https://dev.azure.com/company/DataEngineering/_git/Test/commit/aaabbbbccccdddd"
    }
  ]
}

最佳答案

您只需要使用“Parse JSON”操作来解析您的json数据,然后请引用下面的表达式: enter image description here

上面截图中的整个表达式是:

body('Parse_JSON')?['value'][0]?['commitId']

然后运行后我们就可以得到commitId的值了。 enter image description here

关于azure - 需要在 azure 逻辑应用程序中使用表达式才能获取 JSON 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60924906/

相关文章:

azure - 使用应用程序洞察自定义指标跟踪辅助服务中的方法执行时间

azure - AADSTS50011 : The reply url specified in the request does not match the reply urls configured for the application: '

azure-devops - GitHttpClient 获取 ref/tag 的提交

Azure 逻辑应用 : Check for file type

azure - Azure 虚拟机上的 SSAS

azure - Cloud Explorer 相当于调试 VS2022 用于上传到存储的压缩发布代码?

azure-devops - 存储库 : heading anchors rendering as work item links 中的 Azure DevOps Markdown 预览

azure - 如何在azure devops模板任务中参数化azureSubscription

azure - 逻辑应用发布到 Microsoft Teams 的数据未显示在字段中

azure - 逻辑应用 - 将 HTML 符号转换为纯文本