Connecting Tableau to JSON File

This article will show you the steps involved in connecting Tableau to a JSON file with an example. The code 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

Please click the hyperlink generated by the above query to see the data inside the JSON file and save it to use in this example.

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. For more Data Sources >> Click Here!

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. For more Charts >> Click Here!

Connecting Tableau to JSON File and create bar chart