The Expand JSON step converts JSON into a spreadsheet table format.
In the input data below, it shows what came from a GET call made to a free API: https://api.punkapi.com/v2/beers. This data has multiple JSON columns with a table of 25 rows and 21 columns.
Below are one of the "method" column's row values formatted for easier reading. This is in the row where the column "name" is equal to "Berliner Weisse With Yuzu - B-Sides".
Once we use the Expand JSON step, our output data becomes 28 rows and 30 columns. We've gained 3 rows and 9 columns after expanding the "method mash_temp" dataset with all non-datasets also expanded.
If we filter for beers with the name "Berliner Weisse With Yuzu - B-Sides" and focus on the newly-expanded columns, we see that there's one row per element in the array "method mash_temp" for a total of 4 rows with "Berliner Weisse With Yuzu - B-Sides". If we look closely at the 6 additional columns that contain the newly-expanded data, we'll see the data nested within the JSON object above neatly arranged in a table format.
By default, this step will try and convert as much JSON as it can, and in most cases we won't need to change settings. This step defaults to expanding the first JSON dataset it comes across.
By default, this step also sets to Expand all non-datasets. That setting is nested under the "Non-dataset Options" options. This means that all the object keys will be expanded out to as many columns as it requires.
If you're familiar with JSON, you can think of this step's functionality like the following: datasets are JSON arrays that are expanded into new rows. Non-datasets are JSON objects that are expanded into new columns.
To customize the default settings, we'll first want to make sure the right dataset is selected to be expanded. We can only choose one dataset to expand or can select to expand no datasets. Datasets are expanded so that each entry is put into a new row. If our data has no dataset, then we'll see N/A selected in the first option for Expand the N/A dataset.
Next, if we don't need all non-datasets expanded into columns, we can open the "Non-dataset Options" and switch it from Expand all non-datasets to Expand these non-datasets.
If we select Expand these non-datasets, we'll see an option to specify exactly which non-datasets we should expand into new columns. We can select as many as we require. Whichever non-datasets we choose will be expanded into new columns, and if there are more non-datasets contained within, those will be expanded as well.