Connect Tableau to a local JSON file

Make the connection and set up the data source

  1. Start Tableau and under Connect, select JSON File. Then do the following:
  2. Select the file you want to connect to, and then select Open.
  3. In the Select Schema Levels dialog box, select the schema levels you want to view and analyze in Tableau, and then select OK.
  4. On the data source page, do the following:
  5. (Optional) Select the default data source name at the top of the page, and then enter a unique data source name for use in Tableau. For example, use a data source naming convention that helps other users of the data source figure out which data source to connect to.
  6. Select the sheet tab to start your analysis

SON file data source example

Here is an example of a JSON file as a data source using Tableau Desktop on a Windows computer:

Select schema levels

When you connect Tableau to a JSON file, Tableau scans the data in the first 10,000 rows of the JSON file and infers the schema from that process. Tableau flattens the data using this inferred schema. The JSON file schema levels are listed in the Select Schema Levels dialog box. For more info Tableau Online Training

The schema levels that you select in the dialog box determine which dimensions and measures are available for you to view and analyze in Tableau. If you select a child schema level, the parent level is also selected.

Detect new fields

Sometimes, more fields exist in rows that were not scanned to create the inferred schema. If you notice that a field you need is missing under Schema, you can choose to do one of the following:

  • Scan the entire JSON document. It may take a long time for the scan to complete.
  • Select schema levels from the schema listed and then select OK. Tableau reads your entire document and if more fields are found, they are listed in the Select Schema Levels dialog box.

Whenever Tableau detects that new fields are available, for example, during an extract refresh or when Tableau creates an extract after you’ve selected the schema levels, either an information icon near the file name or a notification on the Select Schema Levels dialog box will indicate that additional fields have been found. Learn more skills from Tableau Certification

Change schema levels

You can change the schema levels you selected by going to the data source page and selecting Data > [JSON file name] > Select Schema Level. Or, hover over the file name on the canvas and select the drop-down menu > Select Schema Level.

Union JSON files

You can union JSON data. To union a JSON file, it must have a .json, .txt, or .log extension.

How dimension folders are organized for hierarchical JSON files

After you select the sheet tab, the selected schema levels of your JSON file show under Dimensions on the Data pane. Each folder corresponds with the schema level you selected, and the attributes associated with that schema level are listed as children of the folder.

For example, in the following image, Stars is a dimension under the schema level Stars rated folder, and Day is a dimension under the schema level Visits folder. Category is also a schema level, but because it is a list of values and not a hierarchy of data, it doesn’t require its own folder, but is instead grouped under a parent folder, Example Business. Note that schema levels in the Select Schema Levels dialog box do not map directly to the folder structure in the Data pane. Folders in the Data pane are grouped by object so that you can easily navigate to fields and still have context for where the fields come from.

Tips for working with JSON data

These tips can help you work with your JSON data in Tableau.

  • Do not exceed the 10×10 limit for nested arrays.

A high number of nested arrays creates a lot of rows. For example, 10×10 nested arrays result in 10 billion rows. When the number of rows Tableau can load into memory is exceeded, an error displays. In this case, use the Select Schema Levels dialog box to reduce the number of selected schema levels.

To get in-depth knowledge, enroll for live free demo on Tableau Training

  • A data source that contains more than 100 levels of JSON objects can take a long time to load.

A high number of levels creates a lot of columns, which can take a long time to process. As an example, 100 levels can take more than two minutes to load the data. As a best practice, reduce the number of schema levels to just the levels that you need for your analysis.

  • A single JSON object cannot exceed 128 MB.

When a single object top-level array exceeds 128 MB, you must convert it to a file where the JSON objects are defined one per line.

  • The pivot option is not supported.

Leave a comment

Design a site like this with WordPress.com
Get started