Import JSON DataSource- A list of Lists
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2025 01:04 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2025 12:28 PM
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:
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
- Type:
File - Format:
JSON - Discard Arrays: Unchecked
- This is crucial. By default, ServiceNow discards arrays. Unchecking this allows it to process each array item as a row.
- 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.
- Since your JSON is a top-level array, the path should be
-
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: -
If you have control over the JSON structure, consider changing it to a more standard format like:
Then you can set the Path for Each Row to
/and mapvaluedirectly in the Transform Map.
This approach is supported by guidance in CR_IM_P1 and servicenow-london-platform-administration, which explain that for JSON arrays, the path must point to the array root (e.g., /incidents/incidents for nested arrays).
