Skip to main content
Windward

Connect to a JSON Data Source

 

 

Overview 

This article covers how to connect to a JSON data source in AutoTag.

 

What you need to establish a connection:

You will need a JSON (JavaScript Object Notation, file name ends in .json) file to establish your connection in AutoTag. The file can be hosted on a website, located on your network, or located on your local machine. The necessary JSON drives are installed when you install AutoTag.
 

Connecting Your Template to a JSON Data Source:

Step 1

From MS Word, Excel or PowerPoint, navigate to the AutoTag Manager tab. 

 

 

Step 2

Once on the AutoTag Manager tab, click on the Data Source button. 

 

 

Step 3

This will open the DataSources list dialog box. Click the Add button. 

 

 

Step 4

Select the JSON option from the ‘Vendor:’ drop down list. 

 

 

Step 5

Fill in the details for your JSON file (whether local or hosted) in the Datasource Connector window. You can also test your connection by using Windward’s sample hosted JSON file (details below).


Datasource Connector Fields:

Vendor:

 Select the JSON option from the drop down list.

Name Type a name for your datasource connection.
File/URL:

Enter the location of the .json file you want to use (you can also Browse to the location)

Credentials:

If the file is stored remotely, and requires authentication, you will need to provide credentials in the Username and Password fields. The Windward sample JSON credentials are:

Root directory:

 This is optional. This is the "default directory" for any import tag requests where the requested file does not have an absolute path. If left blank, AutoTag will use the directory where the data source file is located. If the data source is not a file it will use the directory where the template is located.

Test:

 You can test your JSON connection by clicking this button. If all parameters and credentials are correct and a connection is made, you will receive a successful notification.

 

 

 

 

 

Other Information:

The Windward JSON drivers use JsonPath 2.1.0 as the query language to retrieve your data.

orderby() function:

The .orderby() function may be added to the end of any JsonPath expression. Doing so will return a sorted array.

 

For instance, using the Northwind database to order an array of Employees by their EmployeeID, you would use the query: $.Employees[*].orderby(EmployeeID, 1).

The parameter '1' is passed to indicate that the Employees are ordered in Ascending order. A parameter of '-1' would indicate Descending order.

If an object does not have the property specified by the orderby function (as in the EmployeeID above), then the objects are placed in arbitrary order at the end of the list.

Multiple calls to .orderby() in a single query are not yet supported.

limit() function:

The .limit() function simply limits the number of records returned. Note that the calling order of this, with respect to .orderby() does matter, so make sure you call the functions in the desired order.

ForEach Tags with arrays of literals:

If your JSON file has the form: { array: ["first", "second"] }, we can use a ForEach Tag to iterate through the items of 'array'.

To do this, we can create a ForEach Tag with the select value of “$.array[*]” and a variable with the name value of "varName1". You will also need to create an Out Tag with the select value of "${varName1}" to place within your beginning ForEach Tag and your End (ForEach) Tag.

Handling images:

Images that are embedded in JSON objects (in your file) can be either integer arrays (with values less than 256-bits), or base-64 encoded strings. In either case, use the Out Tag to view an image. The ‘type’ setting should set to ‘BITMAP’.

 

Helpful Links:

Link related to JsonPath origin: http://goessner.net/articles/JsonPath/

Link related to JsonPath 2.1.0 documentation and other functions supported: https://github.com/jayway/JsonPath

Link related to using the JSON AutoTag Wizard: https://wiki.windward.net/Wiki/03.AutoTag/05.AutoTag_User_Guide/03.Tagging/09.Tag_Wizards/JSON_Wizard