Skip to main content

Importing JSON

The JSON importer allows for generic import of links and assets from JSON formatted data. It is particularly useful in conjunction with the HTTP data source for REST APIs, but can also import static data from files. The importer uses JSON path to navigate the structured data.

Compatible with the following data sources

While the details of using JSON path are outlined in the documentation, a brief example will be given here. Consider the following small JSON file:

[
{
"id": 1,
"name": "Bob"
},
{
"id": 2,
"name": "Alice"
}
]

For a simple example, one could import this data set into an asset type "Person" that has a single property called first name. This would result in two assets called Alice and Bob, respectively. This requires two virtual columns that have to be extracted from the JSON data - the ID and the actual name property of the JSON objects. Each virtual column hence requires a JSON path query to extract the relevant data from JSON. By using $ as the base query, JSON path allows accessing the root node of a JSON object - be it an array or a single object. By adding . JSON path is now capable of traversing down into the structure - in our example the virtual column first name would use $.name as a JSON path query:

JSON importer specifics

Importing assets via JSON does not differ much from the general process. If an importer has a 'HTTP' or 'Folder' data source and is configured to use a JSON importer, the relative path to the data needs to be specified. This is not required for text data sources. In order to enable property mapping one must use aforementioned path queries to create virtual column which can then be mapped to properties of the assets in Txture.