What is boolean() prefix
The boolean() prefix is an advanced built-in function that is used to convert a value mapped inside it into a boolean format. This prefix is commonly used in request JSON when a
- Static dropdown values need to be converted into the boolean format e.g. true or false.
- Need to remove key from JSON if don't want to pass boolean value.
JSON:
{
"name": "{{name}}",
"email": "{{email}}",
"additional_info": {
"is_married": "boolean({{is_married}})",
"age": "numeric({{age}})"
}
}
In this JSON, the is_married is enclosed in the boolean() prefix to convert them to boolean format:
JSON:
{
"name": "mahesh",
"email": "[email protected]",
"additional_info": {
"is_married": true,
"age": null
}
}
Using the numeric() prefix can ensure that certain values are always returned in boolean format.
How to Use numeric() prefix:
In the given example API endpoint requires the value of is_married in boolean format. So I'll map is_married inside numeric() prefix like this -
In the workflow page when the user will select is_married value -
I'll get is_married in the boolean format like this -
Note:-
- Avoid using {{##boolean:true##}} or {{##boolean:false##}} when using Pabbly custom fields. Instead, use 'true' or 'false' in a static dropdown
Attachments
Last edited by a moderator: