Filters
- Function filters are useful for advanced data manipulation, and the syntax is inspired by Jinja Filters .
- The filters can be used in Environment Variables and Tests.
- The filter syntax is
{{variable | filter1 | filter2...}}or, in Tests,json.items | filter1 | filter2.... - If you’d like to use filters without a variable, use the
@sign:{{@ | filter1 | filter2}}. - Filters can be used in Headers, Body, Query Params, and Tests.
Filters in Environment Variables
- This is useful for modifying the environment variable value before sending the request.
- The filters can be used in Query Params, Headers, Auth, and Body.

Filters in Tests
- This is useful for advanced use cases to test and set environment variables from the response.

Built-In Filters:
| Function | Description |
|---|---|
| at | The filter will return element at index |
| abs | The filter will return absolute value |
| add | The filter is useful to add number |
| atob | The filter will Base64 decode the value |
| btoa | The filter will Base64 encode the value |
| exec | The filter will execute node command and return value (Paid version required) |
| first | The filter will return first element in array |
| filter | The filter will perform array filter operation |
| format | The format filter useful to format the string output |
| hash | The filter will create hash of the input |
| hmac | The filter will create hash of the input |
| isEmail | The filter will check the input is email or not and return true/false |
| isUrl | The filter will check the input is URL or not and return true/false |
| join | The filter will join array with separator |
| last | The filter will return last element in array |
| length | The filter will return length of the string or array |
| lower | The filter will return lowercase of the string |
| map | The filter will return subset of properties |
| multiply | The filter is useful to multiply numbers |
| parseJSON | The filter will convert string to JSON object |
| prop | The filter will get property value of an object |
| readFile | The filter will read the contents of the file (Paid version required) |
| removeQuotes | The filter will remove quotes from the string |
| removeSpaces | The filter will remove spaces from the string |
| replace | The filter will replace match with replace string |
| setIfValue | The filter will set env variable only when input has value |
| setNull | The filter will set env variable value to null when the property value is null |
| slice | The filter will perform standard array slice operation |
| split | The filter will split the string using the separator |
| stringify | The filter will JSON stringify the object |
| substring | The filter will return substring of the input |
| subtract | The filter will subtract number from input |
| unique | The filter will return unique elements in array |
| upper | The filter will return uppercase of the string |
| urlEncode | The filter will encode the string |
| urlDecode | The filter will decode the string |
at
- The filter returns the element at the at index. The syntax in Tests is
json.items | at(1). - If
json.itemsvalue is[2,6,8,9], then:json.items | at(1)the result will be6json.items | at(-1)the result will be9
abs
- The syntax is
{{number | abs}} - If
numbervalue is -7, then theabsfilter returns 7.
add
- The syntax is
{{number | add(5)}}or{{number | add("variableName")}} - You can pass parameter value as number or env variable name
- e.g 1: if
numbervalue is 6, then add filter will return 11 - e.g 2: if
numberis 5 andvariableis 8, then result is 13
atob
- The filter will decode the value. The syntax is
{{input | atob}}. - If
inputvalue isSGVsbG8gV29ybGQ=, then the result isHello World.
btoa
- The filter will Base64 encode the value. The syntax is
{{input | btoa}}. - If
inputvalue isHello World, then the result isSGVsbG8gV29ybGQ=.
exec
This feature is available only in the paid version.
- The filter executes a node command and returns the value. The syntax is
{{variable | exec("command")}}or, without a variable,{{@ | exec("command")}}. - You can also pass variables as parameters e.g:
{{@ | exec("gcloud auth {0} {1}", "var1", "var2")}} - If
commandvalue isnode --version, then the result isv16.15.0.
first
- The filter returns the first element in an array. The syntax in Tests is
json.items | first. - If
json.itemsvalue is[3,6,8,9], then the result is3.
filter
- The filter performs an array filter operation. The syntax in Tests is
json.items | filter(id>5). - The following operations are supported:
>, >=, <, <=, =, !=, *=, ^=, $=. *=filters using contains operation^=filters using startsWith operation$=filters using endsWith operation
format
- The format filter is useful for formatting string output. The syntax is
{{variable | format("Hello {0}")}}. - If
variablevalue isWorld, then the result isHello World. - Using multiple variables
{{var1 | format("Hello {0} {1} {2}", "var2", "var3")}}, the{0}is replaced withvar1value,{1}withvar2value, and{2}withvar3value. - If you are using this in the Tests tab to set env values, you can use e.g.
json.var1 | format("hello {0} {1}", "var2")in the left input.
hash
- The filter creates a hash of the input. The syntax is
{{variable | hash("algorithm", "encoding")}}or{{variable | hash}}. - @param -
algorithm: The default value isMD5. The values supported areSHA256,SHA512,SHA1,MD5. - @param -
encoding: The default value isbase64. The values supported arehex,base64.
hmac
- The filter creates a hash of the input. The syntax is
{{variable | hmac("secret", "algorithm", "encoding")}}or{{variable | hmac("secret")}}. - @param -
secret: The name of the env variable where secret is saved. - @param -
algorithm: The default value isSHA256. The values supported areSHA256,SHA512,SHA1,MD5. - @param -
encoding: The default value isbase64. The values supported arehex,base64.
isEmail
- The filter checks whether the input is an email and returns true or false. The syntax in Tests is
json.email | isEmail.
isUrl
- The filter checks whether the input is a URL and returns true or false. The syntax in Tests is
json.homepage | isUrl.
join
- The filter will join an array with a separator. The syntax is
{{variable | split(" ") | join("separator")}}or in Testsjson.items | join. - The default
separatoris comma,, so you can usejson.items | join. - If
variablevalue isHello World, then the result isHello-World.
last
- The filter returns the last element in an array. The syntax is
json.items | last. - If
json.itemsvalue is[3,6,8,9], then the result is9.
length
- The filter returns the length of the
stringorarray. The syntax is{{variable | length}}. - If
variablevalue isHello World, then the result is11.
lower
- The filter returns the lowercase of the string. The syntax is
{{variable | lower}}. - If
variablevalue isHello World, then the result ishello world.
map
- The filter returns a subset of properties. The syntax is
{{variable | map("id", "name")}}or in Testsjson.items | map("id"). - e.g 1: In Tests
json.items | map("id"), which results in["123","534","56444"]. - e.g 2:
json.items | map("id", "name"), which results in[{"name":"test1", "id":"123}, {"name":"test2", "id":"534"}].
multiply
- The syntax is
{{number | multiply(5)}}or{{number | multiply("variableName")}} - e.g 1: if
numbervalue is 6, then multiply filter will return 30 - e.g 2: if
numberis 5 andvariableNameis 8, then result is 40
parseJSON
- The filter converts a string to a JSON object. The syntax is
{{address | parseJSON}}. - The filter can be used with other filters, e.g.
{{address | parseJSON | prop("lat")}}.
prop
- The filter gets a property value of an object. The syntax in Tests is
json.items | prop("id"). - e.g 1: If
json.itemsvalue is[{"id":1005, "name":"boston"}], thenprop("id")returns1005. - e.g 2: If the array is
[{"id":1005, "name":"boston"}, {"id":1006, "name":"london"}], thenprop("id")returns1005,1006.
readFile
This feature is available only in the paid version.
- The filter reads the contents of the file. The syntax is
{{pathVar | readFile}}or{{pathVar | readFile("base64")}}. - Create an env variable with the path of the file. The path can be
absoluteorrelativeto the workspace. - Relative paths work only if you enable the
Save To Workspacesetting. - e.g 1:
{{pathVar | readFile}}reads the file as text, which is useful for reading JSON files. - e.g 2:
{{pathVar | readFile("base64")}}reads the file asbase64, which is useful for reading image files. - e.g 3: To use in the request body
{
"data": "{{pathVar | readFile(\"base64\")}}"
}removeQuotes
- The filter removes quotes from the string. The syntax is
{{variable | removeQuotes}}. - if
variablevalue is"Hell"o W'orld, then result isHello World
removeSpaces
- The filter removes spaces from the string. The syntax is
{{variable | removeSpaces}}. - if
variablevalue is"Welcome Hello World, then the result isWelcomeHelloWorld
replace
- The filter replaces a match with a replacement string. The syntax is
{{variable | replace("Hello", "NewValue")}}. - If
variablevalue isHello World, thenreplace("Hello", "New")results inNew World. - You can also pass a single argument,
{{variable | replace("Hello")}}, which replaces with an empty string.
setIfValue
- The filter sets an env variable only when the input has a value. The syntax in Tests is
json.name | setIfValue. - This filter is useful in
Testssection, whenSet Env Variabledropdown selected
setNull
- The filter sets the env variable value to null when the property value is null (by default null values are set as empty). The syntax in Tests is
json.name | setNull. - This filter is useful in
Testssection, whenSet Env Variabledropdown selected
slice
- The filter performs a standard array slice operation. The syntax is
{{variable | split(" ") | slice(1, 2)}}. - If
variablevalue iswelcome to thunder client, then the result is["to"].
split
- The filter splits the string using the separator. The syntax is
{{variable | split("separator")}}. - If
variablevalue isHello World, thensplit(" ")results in["Hello", "World"].
stringify
- The filter JSON-stringifies the object. The syntax is
{{variable | stringify}}.
substring
- The filter returns a substring of the input. The syntax is
{{variable | substring(start, end)}}. - If
variablevalue isHello World, thensubstring(-5)results inWorld. - If you want to pass
input.length - 5, just pass-5.
subtract
- The syntax is
{{number | subtract(5)}}or{{number | subtract("variable")}}. - e.g 1: If
numbervalue is 6, then the subtract filter returns 1. - e.g 2: If
numberis 45 andvariableis 8, then the result is 37.
unique
- The filter returns unique elements in an array. The syntax is
json.items | unique. - If
json.itemsvalue is[3,8,9,6,8,9], then the result is[3,8,9,6].
upper
- The filter returns the uppercase of the string. The syntax is
{{variable | upper}}. - If
variablevalue isHello World, then the result isHELLO WORLD.
urlEncode
- The filter will encode the string. The syntax is
{{queryParam1 | urlEncode}}. - If
queryParam1value ishello+world, then the result ishello%2Bworld.
urlDecode
- The filter will decode the string. The syntax is
{{queryParam1 | urlDecode}}. - If
queryParam1value ishello%2Bworld, then the result ishello+world.
Last updated on