The Jakarta release of ServiceNow introduces support for a new import/export data format: JSON. This blog post is a quick overview of where and how you can interact with these new features.
Export to JSON
From a list of records, you can now choose JSON from the list of file formats when exporting data. Right click the header of any record list and select Export > JSON.
The output of this export is a simple JSON structure. This structure contains a single property called records. The records property is an array of objects, and each object is a record from the table. Here’s an example taken from the cmn_location table. This has been truncated for brevity.
“name”: “2-10-1 Yurakucho, Chiyoda-ku, Tokyo”,
Note: data exported in this way cannot be directly imported like XML unloads. JSON exported data is primarily meant for consumption by external apps. If needed, you can use the exported file in a JSON Data Source. I’ll talk more about this in a minute.
JSON Export Sets
When creating Export Sets, you now have the option to choose JSON as the Format. The structure of the exported data will look the same as the structure shown for “Export to JSON”.
Importing JSON / JSON Data Data Sources
You can now import JSON using JSON Data Sources. To create a JSON data source, set the Type to File and the Format to JSON. Similar to XML Data Sources, you will need to specify a Path that indicates which part of the JSON object to treat as a row of data.
In the screenshot below, I’ve configured a JSON Data Source to import the records exported by the Export Set example above. Because the records are all in an array object called records, the Path is /records/records. Whenever the path is pointing to a named array, you must enter the array element name twice in the path.