如何将解析器转换用于IIC中的JSON数据?

发布于 2025-02-03 22:34:50 字数 10050 浏览 2 评论 0原文

我是iics的新手,并且我的json数据如下,我将在CSV文件中解析。我正在使用 link 参考以实现这种转变。我在iics中创建了有效的映射。该映射运行良好。但是,当我看到我的工作时,我将收到以下错误。

不知道怎么了?我需要将JSON数据文件保存为TXT文件吗?

任何帮助将不胜感激!提前致谢!

运行映射后的错误

[error]无法处理数据:文件c:/iicslabfiles/test.json不存在或不可读取 - 有关更多信息,请参见文件:// C:/Progra〜1/Informatica Cloud Secure Agent/apps/data_integration_server/data/cmreports/tmp/2022-06-01/hierarchyparser_h2r_udt_8gns3_only_only_h2r_h2r_xmap_/event.cme

<B#80010%#>
    !~109146~165266~~10.2.2.65()
    <B#80032%#>
    </B#8032%#>
    <m -- XMap%m>
        !~103149~1654220266~~Pages\/page_m_1.cmv%Pages\/page_m_1.json
        <B#80037%XML#>
            !~1031~1654220266~~Pages\/Input_of_m_1.cmv%Pages\/Input_of_m_1.json
            <LocalFile>
                !~309025~16542266~~C:\/IICSLabFiles\/test.json
            </LocalFile>
            !~103205~16540266~~C:\/IICSLabFiles\/test.json
            !~3033~1654220266~~
        </B#8007%XML#>
    </m -- XMap>
</B#80010%#>

json数据保存在test.json中(用文件类型为JSON文件):

{
  "current_page": 1,
  "first_page_url": "https://covid-api.com/api/regions?per_page=20&page=1",
  "last_page_url": "https://covid-api.com/api/regions?per_page=20&page=50",
  "next_page_url": "https://covid-api.com/api/regions?per_page=20&page=2",
  "prev_page_url": null,
  "per_page": "20",
  "last_page": 50,
  "from": 1,
  "path": "https://covid-api.com/api/regions",
  "to": 20,
  "total": 997,
  "data": [
    {
      "iso": "CHN",
      "name": "China"
    },
    {
      "iso": "TWN",
      "name": "Taipei and environs"
    },
    {
      "iso": "USA",
      "name": "US"
    },
    {
      "iso": "JPN",
      "name": "Japan"
    },
    {
      "iso": "THA",
      "name": "Thailand"
    },
    {
      "iso": "KOR",
      "name": "Korea, South"
    },
    {
      "iso": "SGP",
      "name": "Singapore"
    },
    {
      "iso": "PHL",
      "name": "Philippines"
    },
    {
      "iso": "MYS",
      "name": "Malaysia"
    },
    {
      "iso": "VNM",
      "name": "Vietnam"
    },
    {
      "iso": "AUS",
      "name": "Australia"
    },
    {
      "iso": "MEX",
      "name": "Mexico"
    },
    {
      "iso": "BRA",
      "name": "Brazil"
    },
    {
      "iso": "COL",
      "name": "Colombia"
    },
    {
      "iso": "FRA",
      "name": "France"
    },
    {
      "iso": "NPL",
      "name": "Nepal"
    },
    {
      "iso": "CAN",
      "name": "Canada"
    },
    {
      "iso": "KHM",
      "name": "Cambodia"
    },
    {
      "iso": "LKA",
      "name": "Sri Lanka"
    },
    {
      "iso": "CIV",
      "name": "Cote d'Ivoire"
    }
  ]
}

** JSON模式,保存在层次结构架构中(用文件类型为JSON文件)**

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "current_page": {
      "type": "integer"
    },
    "first_page_url": {
      "type": "string"
    },
    "last_page_url": {
      "type": "string"
    },
    "next_page_url": {
      "type": "string"
    },
    "prev_page_url": {
      "type": "null"
    },
    "per_page": {
      "type": "string"
    },
    "last_page": {
      "type": "integer"
    },
    "from": {
      "type": "integer"
    },
    "path": {
      "type": "string"
    },
    "to": {
      "type": "integer"
    },
    "total": {
      "type": "integer"
    },
    "data": {
      "type": "array",
      "items": [
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        }
      ]
    }
  },
  "required": [
    "current_page",
    "first_page_url",
    "last_page_url",
    "next_page_url",
    "prev_page_url",
    "per_page",
    "last_page",
    "from",
    "path",
    "to",
    "total",
    "data"
  ]
}

源连接设置

Path
C:/IICSLabFiles/test.json

I am new to IICS and I have JSON data as below, which I would to parse in csv file. I am using this link as a reference to achieve this transformation. I created valid mapping in IICS.The mapping runs fine. However, when I see my jobs I am receiving below error.I went to the path mentioned and opened the Events.cme file in Notepad but cannot make of what file is talking about (Note: in belwo output I deleted few of the numbers)

Not sure what is wrong ? Do I need to save my JSON data file as txt file ?

Any help will be appreciated! Thanks in advance!

ERROR after running the mapping

[ERROR] Failed to process data: File C:/IICSLabFiles/test.json doesn't exist or isn't readable- for more information see file://C:/PROGRA~1/Informatica Cloud Secure Agent/apps/Data_Integration_Server/data/CMReports/Tmp/2022-06-01/HierarchyParser_h2r_udt_8gns3_ONLY_H2R_XMAP_/Events.cme

Opening Events.cme file in notepad produces following

<B#80010%#>
    !~109146~165266~~10.2.2.65()
    <B#80032%#>
    </B#8032%#>
    <m -- XMap%m>
        !~103149~1654220266~~Pages\/page_m_1.cmv%Pages\/page_m_1.json
        <B#80037%XML#>
            !~1031~1654220266~~Pages\/Input_of_m_1.cmv%Pages\/Input_of_m_1.json
            <LocalFile>
                !~309025~16542266~~C:\/IICSLabFiles\/test.json
            </LocalFile>
            !~103205~16540266~~C:\/IICSLabFiles\/test.json
            !~3033~1654220266~~
        </B#8007%XML#>
    </m -- XMap>
</B#80010%#>

JSON Data that is saved in test.json (with File type as JSON File):

{
  "current_page": 1,
  "first_page_url": "https://covid-api.com/api/regions?per_page=20&page=1",
  "last_page_url": "https://covid-api.com/api/regions?per_page=20&page=50",
  "next_page_url": "https://covid-api.com/api/regions?per_page=20&page=2",
  "prev_page_url": null,
  "per_page": "20",
  "last_page": 50,
  "from": 1,
  "path": "https://covid-api.com/api/regions",
  "to": 20,
  "total": 997,
  "data": [
    {
      "iso": "CHN",
      "name": "China"
    },
    {
      "iso": "TWN",
      "name": "Taipei and environs"
    },
    {
      "iso": "USA",
      "name": "US"
    },
    {
      "iso": "JPN",
      "name": "Japan"
    },
    {
      "iso": "THA",
      "name": "Thailand"
    },
    {
      "iso": "KOR",
      "name": "Korea, South"
    },
    {
      "iso": "SGP",
      "name": "Singapore"
    },
    {
      "iso": "PHL",
      "name": "Philippines"
    },
    {
      "iso": "MYS",
      "name": "Malaysia"
    },
    {
      "iso": "VNM",
      "name": "Vietnam"
    },
    {
      "iso": "AUS",
      "name": "Australia"
    },
    {
      "iso": "MEX",
      "name": "Mexico"
    },
    {
      "iso": "BRA",
      "name": "Brazil"
    },
    {
      "iso": "COL",
      "name": "Colombia"
    },
    {
      "iso": "FRA",
      "name": "France"
    },
    {
      "iso": "NPL",
      "name": "Nepal"
    },
    {
      "iso": "CAN",
      "name": "Canada"
    },
    {
      "iso": "KHM",
      "name": "Cambodia"
    },
    {
      "iso": "LKA",
      "name": "Sri Lanka"
    },
    {
      "iso": "CIV",
      "name": "Cote d'Ivoire"
    }
  ]
}

**JSON SCHEMA that is saved in Hierarchy schema (with file type as JSON FILE) **

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "current_page": {
      "type": "integer"
    },
    "first_page_url": {
      "type": "string"
    },
    "last_page_url": {
      "type": "string"
    },
    "next_page_url": {
      "type": "string"
    },
    "prev_page_url": {
      "type": "null"
    },
    "per_page": {
      "type": "string"
    },
    "last_page": {
      "type": "integer"
    },
    "from": {
      "type": "integer"
    },
    "path": {
      "type": "string"
    },
    "to": {
      "type": "integer"
    },
    "total": {
      "type": "integer"
    },
    "data": {
      "type": "array",
      "items": [
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        },
        {
          "type": "object",
          "properties": {
            "iso": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "iso",
            "name"
          ]
        }
      ]
    }
  },
  "required": [
    "current_page",
    "first_page_url",
    "last_page_url",
    "next_page_url",
    "prev_page_url",
    "per_page",
    "last_page",
    "from",
    "path",
    "to",
    "total",
    "data"
  ]
}

Source connection Setup

enter image description here

Path_text file contains following information

Path
C:/IICSLabFiles/test.json

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

静待花开 2025-02-10 22:34:50

错误消息“ c:/iicslabfiles/test.json不存在或不可读取”,建议您尝试阅读本地文件。这是运行映射的安全代理上的文件的路径,还是存储在笔记本电脑上的文件的路径?您的来源定义是什么?

请记住,您可以在笔记本电脑上设计映射,在那里您可以访问存储在笔记本电脑上的文件 - 但是一旦执行,它将被安全的代理处理(可以是不同的机器,云托管等)。在这种情况下,似乎安全代理无法在给定位置访问文件。

也可以将安全代理安装在计算机上,并在您实际上一直在设计映射的笔记本电脑上运行该过程。在这种情况下,请确保路径中没有错别字,没有前导或落后空的空间。而且,如果它是基于Windows的安全代理,请验证这些路径,因为您使用的路径具有Froward Slashes,而Windows通常使用后斜线:

C:/IICSLabFiles/test.json
vs
C:\IICSLabFiles\test.json

The error message "C:/IICSLabFiles/test.json doesn't exist or isn't readable" suggests you try reading local file. Is this the path to the file located on Secure Agent running the mapping or is it the path to a file stored on your laptop? What is your Source definition?

Keep in mind that you design the mapping on your laptop where you have access to files stored on your laptop - but once you execute, it gets processed by Secure Agent (that can be a different machine, cloud-hosted, etc.). In this case it seems the Secure Agent cannot access the file at the given location.

It's also possible to have Secure Agent installed on your machine and run the process on the laptop where you actually have been designing the mapping. In such case please make sure there are no typos in the path, no leading or trailing empty spaces. And if it's a Windows-based Secure Agent, verify the paths as the one you use has froward slashes while Windows uses backslashes usually:

C:/IICSLabFiles/test.json
vs
C:\IICSLabFiles\test.json
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文