Load data using JSON file

Vinayak10
Kilo Guru

Hi All,

I am trying to load using JSON file as attachment but getting error's. i have followed below steps let me know if i am wrong at any stpes.

 

1. Created data source with Type: File, Format: JSON and File retrieval method: Attachement.

2. added import set table which is extended by Import Set Row .

3. Attached  simpe JSON (created json file with .json) having data as below.

{
"source":"HI",
"incidents":"Test"
}

 

getting below error while clicking Load all Records/Test load 20 records.

Error: com.glide.db.impex.datasource.DataSourceException: org.jaxen.XPathSyntaxException: Unexpected ''

 

Any lead thanx in Advance.

 

Thanks and Regards,

Vinayak

8 REPLIES 8

Yes, this is the main issue, the form sometimes does not have the Path for each row. Configure your form layout, add the "Path for each row" then you will see its mandatory. Fill it with a forward slash (/) and job done!

Hi Ankur Bawiskar,

I have a doubt regarding the importing of entire json data what I did is like I created a txt file which it contains all json data Example :-
{
  "incidents": [
    {
      "short_description": "hello",
      "comments": "test"
    },
    {
      "short_description": "hello1",
      "comments": "test1"
    }

   ],
   "Problem": [
    {
      "short_description": "Hi",
      "comments": "Demo"
    },
    {
      "short_description": "Hi1",
      "comments": "Demo1"
    }
  ],

"Change": [
    {
      "short_description": "Hey",
      "comments": "Cat"
    },
    {
      "short_description": "Hey1",
      "comments": "Cat1"
    }
  ],
}
My question is what should we have to mention in path for each row field so that we can extract all the json data from json txt file to data source.

Sai92
Tera Contributor

Hi,

The JSON structure you are trying to load is defined as Orphan Array in ServiceNow.

You need to mention // in the Path for each row field.

 

find_real_file.png

 

This comment should be marked as the solution for passing the JSON object as asked for in the OP.