Connecting Tableau to JSON File

This article will show you the steps involved in connecting Tableau to a JSON file with an example. The screenshot below will show you the sql query we used to generate the JSON file.

SELECT Cat.[EnglishProductCategoryName] AS Category, 
       SubCat.[EnglishProductSubcategoryName] AS SubCategory, 
       Prod.EnglishProductName AS ProductName, 
       Prod.Color, 
       SUM(Fact.OrderQuantity) AS Orders, 
       SUM(Fact.TotalProductCost) AS ProductCost, 
       SUM(Fact.SalesAmount) AS Sales, 
       SUM(Fact.TaxAmt) AS Tax
FROM FactInternetSales AS Fact
   INNER JOIN DimProduct AS Prod ON Fact.ProductKey = Prod.ProductKey
   INNER JOIN DimProductSubcategory AS SubCat ON Prod.ProductSubcategoryKey = SubCat.ProductSubcategoryKey 
   INNER JOIN DimProductCategory AS Cat ON SubCat.ProductCategoryKey = Cat.ProductCategoryKey
GROUP BY Cat.[EnglishProductCategoryName], SubCat.[EnglishProductSubcategoryName],
		Prod.EnglishProductName, Prod.Color
FOR JSON PATH, 
INCLUDE_NULL_VALUES
Query to Get Data

The data inside the file is

File

How to connect Tableau to a JSON file?

First, open the desktop and click connect to a JSON file option. It will open a window to choose the existing JSON file from the file system. Let us select to file that we show above.

Connecting Tableau to JSON File

Tableau opens the Select Schema Levels window to choose the schema. Then, as it is a simple and clean file, click OK.

Select Schema Levels

Now, you can see the data inside the file.

Data Inside the File

Let me design a simple Tableau bar chart from the JSON file data.

Connecting Tableau to JSON File and create bar chart