json - 按值对 json 进行排序,然后提取第一个值

标签 json azure azure-logic-apps

我从逻辑应用中的 HTTP 操作收到这样的响应正文:

[
  {
    "refreshId": "08702296-a2ad-43c5-8729-71dc7af27361",
    "startTime": "2019-02-28T14:53:34.9",
    "endTime": "2019-02-28T15:03:52.62",
    "status": "failed"
  },
  {
    "refreshId": "30484b8a-1934-4ffa-9377-ac9e558614fe",
    "startTime": "2019-02-08T20:20:51.2",
    "endTime": "2019-02-08T20:20:51.9",
    "status": "failed"
  },
  {
    "refreshId": "34b23346-9b6c-4d94-bf77-adc129babaa1",
    "startTime": "2019-02-17T05:37:48.067",
    "endTime": "2019-02-18T07:11:44.167",
    "status": "failed"
  },
  {
    "refreshId": "4a9b715c-e4df-4beb-b1f4-ef696e0c23bb",
    "startTime": "2019-03-05T16:05:22.97",
    "endTime": "2019-03-05T16:28:15.01",
    "status": "failed"
  }

]

我想在 starttime 上对此正文进行排序,然后提取第一个正文的 refreshId。我可以在逻辑应用程序中执行此操作吗?

最佳答案

您可以使用Select操作将所有startTime值输出为刻度数组:

enter image description here

enter image description here

然后使用过滤操作来查找具有最小或最大刻度值(取决于“第一个”的含义)刻度值的记录:

enter image description here enter image description here

从那里,您可以使用 body('Filter_array')[0].refreshId 提取您要查找的数据。

enter image description here

关于json - 按值对 json 进行排序,然后提取第一个值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55045047/

相关文章:

azure-logic-apps - 能够在 SQL 连接器的逻辑应用程序中使用 KeyVault

node.js - 为什么我需要在 package.json 上有一个构建脚本来在 Now 上部署一些东西?我该如何解决?

json - Golang 结构字段名称并解码到此结构中

c# - 在适用于 .NET 的 Azure 管理库中创建具有多个声明的 Azure 服务总线策略

Azure Active Directory B2C 自定义邀请策略 - 在步骤之间传递自定义声明

json - 如何将大型 JSON 数组文件加载到 Azure Data Lake Analytics (ADLA) 中

azure - 在Azure逻辑应用程序中,如果循环条件第一次迭代失败,如何在内部中断循环

Azure 逻辑应用程序 - 请求中的预期失败导致整个运行为 "failed"

java - Jackson JSON解析映射转换

iOS 9 解析JSON的最佳方案