In this video you'll learn how to use the GET filter to handle situations where a variable may or may not be present in order to avoid errors.
More about the GET filter
The GET filter allows you to return the value of an object at a specified path. In other words, it's another way to use dot notation but with a filter.
You can think of the GET filter like replacing a .
in dot notation. For example, to retrieve the make of a car instead of car.make
- you could apply the GET filter to say car|GET|make
The GET filter is applied to get the value of the specified path 'make' from the 'car' object/variable.
Why use the GET filter?
The GET filter has a unique advantage that can be very useful for certain use cases. It allows you to define a default value in case the specified path does not exist.
Use cases where this may come in handy would be when calling an external API or receiving a Webhook and the returned payload can differ. Possibly you are working with a field that is sometimes present and sometimes not. Defining a default value with the GET filter allows your function stack to continue to run and complete the logic you are performing. You can also use conditional logic based on a default value to perform certain logic if the specified field does not exist.
Read more: