Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Import JSON DataSource- A list of Lists

rad2
Mega Sage

I have a JSON file, which is an array in the following format

[
	["test"],
	["test1"],
	["test2"]
]

How do i set the datasource settings so i get three records in the import set

5 REPLIES 5

Michelle Bryant
ServiceNow Employee
ServiceNow Employee

Hi Mega,

 

To import your JSON array into a ServiceNow import set and ensure it creates three records, you need to configure the Data Source settings correctly. Based on your JSON structure:

 

MichelleBryant_0-1756408531541.png

This is a top-level array of arrays, which is a bit unconventional for ServiceNow's JSON import expectations. Here's how to handle it:

Recommended Data Source Settings

  1. Type: File
  2. Format: JSON
  3. Discard Arrays: Unchecked
    • This is crucial. By default, ServiceNow discards arrays. Unchecking this allows it to process each array item as a row.
  4. Path for Each Row: /
    • Since your JSON is a top-level array, the path should be / to treat each array element (["test"], etc.) as a row.

 

  • If you want to extract the string inside each sub-array (e.g., "test"), you’ll need a Transform Map with a Scripted Transform that accesses the first element of each array row:

    MichelleBryant_2-1756408970660.png

     

  • If you have control over the JSON structure, consider changing it to a more standard format like:

    MichelleBryant_3-1756409011419.png

     

    Then you can set the Path for Each Row to / and map value directly in the Transform Map.

 

This approach is supported by guidance in  and , which explain that for JSON arrays, the path must point to the array root (e.g., /incidents/incidents for nested arrays).