无效的JSON。 “ParseJson”类型操作的“content”属性必须是有效的 JSON

问题描述 投票:0回答:1

我尝试从 azure blob 存储帐户获取 json 文件,并检查该 json 中的过期字段,如果过期时间少于 2 个月,则需要发送包含该数据的电子邮件。

问题是...

无效的 JSON。 “ParseJson”类型的操作的“content”属性必须是 ParseJson 中的有效 JSON

ParseJson 输入

[
    
    {
        "Environment":  "DEV",
        "Application":  "OTHER",
        "Keyvault":  "key-xx-dd",
        "Secret":  "secrect1",
        "Expires":  "2023-10-19T12:51:20+00:00"
    },
    {
        "Environment":  "DEV",
        "Application":  "OTHER",
        "Keyvault":  "key-xx-dd",
        "Secret":  "secrect2",
        "Expires":  "2023-10-19T12:51:20+00:00"
    },
    
    {
        "Environment":  "DEV",
        "Application":  "OTHER",
        "Keyvault":  "key-xx-dd",
        "Secret":  "secrect3",
        "Expires":  "2023-10-19T12:51:20+00:00"
    }
]

JsonSchema

{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "Application": {
        "type": "string"
      },
      "Environment": {
        "type": "string"
      },
      "Expires": {
        "type": "string"
      },
      "Keyvault": {
        "type": "string"
      },
      "Secret": {
        "type": "string"
      }
    },
    "required": [
      "Environment",
      "Application",
      "Keyvault",
      "Secret",
      "Expires"
    ]
  }
}

原始输入 ParseJson

{
    "content": "[\r\n    \r\n    {\r\n        \"Environment\":  \"DEV\",\r\n        \"Application\":  \"OTHER\",\r\n        \"Keyvault\":  \"key-xx-dd\",\r\n        \"Secret\":  \"secrect1\",\r\n        \"Expires\":  \"2023-10-19T12:51:20+00:00\"\r\n    },\r\n    {\r\n        \"Environment\":  \"DEV\",\r\n        \"Application\":  \"OTHER\",\r\n        \"Keyvault\":  \"key-xx-dd\",\r\n        \"Secret\":  \"secrect2\",\r\n        \"Expires\":  \"2023-10-19T12:51:20+00:00\"\r\n    },\r\n    \r\n    {\r\n        \"Environment\":  \"DEV\",\r\n        \"Application\":  \"OTHER\",\r\n        \"Keyvault\":  \"key-xx-dd\",\r\n        \"Secret\":  \"secrect3\",\r\n        \"Expires\":  \"2023-10-19T12:51:20+00:00\"\r\n    }\r\n]\r\n",
    "schema": {
        "type": "array",
        "items": {
            "type": "object",
            "properties": {
                "Application": {
                    "type": "string"
                },
                "Environment": {
                    "type": "string"
                },
                "Expires": {
                    "type": "string"
                },
                "Keyvault": {
                    "type": "string"
                },
                "Secret": {
                    "type": "string"
                }
            },
            "required": [
                "Environment",
                "Application",
                "Keyvault",
                "Secret",
                "Expires"
            ]
        }
    }
}
azure-logic-apps
1个回答
0
投票

这是一个

ZWNBSP
角色,正在修改
Parse_JSON
动作的内容。您将无法在记事本或 blob 内容的编辑选项中看到它,但可以在记事本 ++ 中通过视图 --> 显示符号 --> 显示非打印字符看到它。

enter image description here

有两种方法可以修复它。

  1. 手动删除它并将文件重新上传到 Blob 存储,然后触发逻辑应用。

  2. 您还可以添加

    Html to Text
    操作来解决此问题。

enter image description here

enter image description here

输出:

enter image description here

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.