Filters are what make the function flexible helping you to easily manipulate data.
Filters are added as the second argument of the function
In case no filter is filled, the function will return all the nodes of the resulting JSON object.
Filters are a powerful tool to navigate into the JSON and display only certain nodes.
To find the right filter, start by returning the full JSON, then find the filter from the 1st column.
Hence, to retrieve the domain extension of all the countries, you can use:
which will return
In this example, IMPORTJSON has detected an array and has automatically pivoted the countries in columns. The first row shows the index for each country. You can combine it with the filter to only return the domain extension for a specific country
IMPORTJSON accepts a range of filters
Filters can also be joined in one cell by separating them with a comma
Filters can be useful to have elements in a JSON displayed into columns. Indeed, IMPORTJSON will pivot into a table only if all the elements returned are part of the same array. To trigger that, you should filter with the base of the array.
- Absolute path: Only the elements directly descending from the nodes will be listed
- Relative path: The function will ignore whether the filter is a direct descendant of the root or not
or use the alias
Widcard: Use an * to replace a chain of characters
will display all the nodes which have names starting with “node”