【问题标题】:How to parse a dynamic Json - Power Automate如何解析动态 Json - Power Automate
【发布时间】:2021-05-17 17:50:30
【问题描述】:

我从 Azure LogAnalytics 得到一个 http 响应,响应是这样的 Json

{
 "tables": [
{
  "name": "PrimaryResult",
  "columns": [
    {
      "name": "TimeGenerated",
      "type": "datetime"
    },
    {
      "name": "DestinationIP",
      "type": "string"
    },
    {
      "name": "DestinationUserName",
      "type": "string"
    },
    {
      "name": "country_name",
      "type": "string"
    },
    {
      "name": "country_iso_code",
      "type": "string"
    },
    {
      "name": "AccountCustomEntity",
      "type": "string"
    }
  ],
  "rows": [
    [
      "2021-05-17T14:07:01.878Z",
      "158.000.000.33",
      "luis",
      "United States",
      "US",
      "luis"
       ]
     ] 
   } 
 ]
}

我永远不会得到相同的列,或者有时我会得到更多包含这样数据的行

  {
 "tables": [
{
  "name": "PrimaryResult",
  "columns": [
    {
      "name": "Account",
      "type": "string"
    },
    {
      "name": "Computer",
      "type": "string"
    },
    {
      "name": "IpAddress",
      "type": "string"
    },
    {
      "name": "AccountType",
      "type": "string"
    },
    {
      "name": "Activity",
      "type": "string"
    },
    {
      "name": "LogonTypeName",
      "type": "string"
    },
    {
      "name": "ProcessName",
      "type": "string"
    },
    {
      "name": "StartTimeUtc",
      "type": "datetime"
    },
    {
      "name": "EndTimeUtc",
      "type": "datetime"
    },
    {
      "name": "ConnectinCount",
      "type": "long"
    },
    {
      "name": "timestamp",
      "type": "datetime"
    },
    {
      "name": "AccountCustomEntity",
      "type": "string"
    },
    {
      "name": "HostCustomEntity",
      "type": "string"
    },
    {
      "name": "IPCustomEntity",
      "type": "string"
    }
  ],
  "rows": [
    [
      "abc\\abc",
      "EQ-DC02.abc.LOCAL",
      "0.0.0.0",
      "User",
      "4624 - An account was successfully logged on.",
      "10 - RemoteInteractive",
      "C:\\Windows\\System32\\svchost.exe",
      "2021-05-17T15:02:25.457Z",
      "2021-05-17T15:02:25.457Z",
      2,
      "2021-05-17T15:02:25.457Z",
      "abc\\abc",
      "EQ-DC02.abc.LOCAL",
      "0.0.0.0"
    ],
    [
      "abc\\eona",
      "EQPD-SW01.abc.LOCAL",
      "0.0.0.0",
      "User",
      "4624 - An account was successfully logged on.",
      "10 - RemoteInteractive",
      "C:\\Windows\\System32\\svchost.exe",
      "2021-05-17T15:21:45.993Z",
      "2021-05-17T15:21:45.993Z",
      1,
      "2021-05-17T15:21:45.993Z",
      "abc\\abc",
      "EQPD-SW01.abc.LOCAL",
      "0.0.0.0"
    ]
    ]
  }
]

}

我正在使用 Power Automate 将这种 Json 解析为对象或做出响应 问题是,如何将“列”和“行”解析为对象?

【问题讨论】:

  • 任何后续问题?

标签: json object parsing power-automate


【解决方案1】:

Similar discussion 出现在社区论坛中,solution identified 是:

解析 JSON 并将其转换为 XML,然后在 Flow 中使用 XPATH 搜索键

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-11-26
    • 2014-05-23
    • 2021-12-18
    • 1970-01-01
    • 2019-12-27
    • 1970-01-01
    • 2022-06-21
    • 2021-08-12
    相关资源
    最近更新 更多