How to use Parser Transformation for JSON data in IICS?

887 views Asked by At

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
1

There are 1 answers

1
Maciejg On

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