About JSON Databases

You can use the Database Setup wizard to convert data in an external JSON file or in embedded sample data to a database table. The structure of your JSON file or embedded data influences the fields and records that result from this conversion.

As with text, XML, and SAP IDoc files, the JSON file or embedded data that you provide in the wizard is considered to be a sample file that is replaced with a different file during automated printing. Therefore, the sample file should contain examples of all nodes that are likely to appear in the JSON files that you will use for printing. The database schema is created from these nodes.

BarTender automatically performs data type detection for the String, Integer, Boolean, Decimal, and DateTime data types.

ClosedMaster Record Selection

By default, BarTender uses the “root” or a single array as the master record node. However, you can use the Master Record Selection page in the Database Setup wizard to specify the node in the JSON file that you want to be the master record node. When you do this, you define what constitutes a record and how many records are generated from the JSON. Only one JSON element can be designated as the master record node.

In the wizard, the schema of the JSON is shown in a tree view. Select the node in the tree that you want for the master record node, and a preview of the resulting database table is displayed on the Fields tab.

ClosedField Selection

After you select the master record node, you can use the Field Selection page of the Database Setup wizard to select the nodes that you want to contribute field data (columns) to your database. To do this, click to select or clear the check boxes in the Available Nodes area to include or exclude nodes (columns). A preview of the resulting database table is displayed on the Fields tab.

You can also use this page to specify how you want repeating nodes, which contribute multiple values to a column, to be handled.

For example, suppose that you are using the following JSON file.

You select Name as the master record node, exclude the type node, include the species node, and then select Concatenate in the Select option for repeating node list. The resulting database is as follows.

ClosedOptions for Repeating Values

JSON arrays can result in multiple values (repeating nodes) for a single database column. BarTender supports several methods for handling these values.

The options that are available in the Database Setup wizard vary depending on the value's data type and include the following: