Data source type REST : how to give jpath_rooth node for the following response data

Kachu
Kilo Sage

Hi Community,

I have created Data source with type REST and created the REST action with necessary inputs.

i am getting data in JSON format and when i click load test data i dont see any record in my staging table. I figured there is something wrong with my path for each row field in the Data source. i tried giving /data/data  this throws error saying expected '.".?/. 

Data according to the post man and REST message is in below format

 
{
    "data": [
        [
            {
                "columnName": "Employee Number",
                "dataType": "xs:string",
                "maxLength": "20",
                "value": "001235"
            },
            {
                "columnName": "Employment Status",
                "dataType": "xs:string",
                "maxLength": "2002",
                "value": "Active"
            },
            {
                "columnName": "Full/Part Time Code",
                "dataType": "xs:string",
                "maxLength": "4",
                "value": "F"
            },
            {
                "columnName": "Salary Or Hourly Code",
                "dataType": "xs:string",
                "maxLength": "4",
                "value": "H"
            },
            {
                "columnName": "Employee Name (Last Suffix, First MI)",
                "dataType": "xs:string",
                "maxLength": "2414",
                "value": "randy, oden."
            },​

Here is the path that i gave

find_real_file.png

 

Error that i received  with above path.

find_real_file.png

Can any one suggest me how to give this "path for Each row" in order for that to parse data on to the staging stable (import set) ?

Thank you.

3 REPLIES 3

Maik Skoddow
Tera Patron
Tera Patron

Hi @Kachu 

as you can read on page https://docs.servicenow.com/bundle/rome-platform-administration/page/administer/import-sets/referenc...:

For JSON arrays, the path for each row must specify the array root element twice, such as /incidents/incidents.

As in your JSON structure you have 2 nested arrays, I assume the correct path must be

/data/data/data/data

Kind regards
Maik

I tried  with /data/data/data/data. it giving error saying no fields for mapping to headers.

OK is as able to get data by /data/data/* or data/data/data. But the data is getting stored as rows instead of Columns with column name . Can you suggest me how can i get it right.