Filter JSON by fields
Filter a JSON object by fields/keys
“Filter JSON by fields” allows you to filter out unwanted fields in a JSON dictionary.
On this page, we will introduce the Tool step to “Filter JSON by fields”.
How to use “Filter JSON by fields” step
Add the component
Add the “Filter JSON by fields” step to your Tool (check how to get started with creating a tool).
Object to filter
A “Filter JSON by fields” step requires a JSON object as an input. This object can be entered within the step.
However, it is often more practical to fetch the value from an input component (e.g. JSON input) or
another step output (e.g. String to JSON).
Use {{variable name}}
to provide the data to the “Filter JSON by fields” step.
Fields to keep
This is to specify which fields (i.e. dictionary keys in the JSON input) must be kept. Note that the field names must be typed EXACTLY the same as what was provided in the input.
Follow the links below for more information about
- How to run a step
- How to delete a step
- How to configure output
- How to configure a default value
- How to move a step in a Tool
- How to duplicate a step
- How to add condition to a step (i.e. execute only if a condition is met)
- How to loop a step (i.e. run one step multiple times)
Access the step output
The output is a dictionary with a key filtered
.
Below you can see samples where the default name assigned to the step json_filtered
is used.
Note that a step name is different from the step title. Step titles can be found on the top left
of steps. A step name is shown on the bottom left, in smaller font and highlighted green.
Common errors
Unsupported input
An error similar to the one noted below indicates that the provided input is not a valid JSON object.
Was this page helpful?