Array
Last updated
Was this helpful?
Last updated
Was this helpful?
Adds a new element to the end of the array, and return the updated array
parent value
The original array you'd like to modify
[1,2,3,4]
value
The value to add to the end of the array
5
parent value: [1, 2, 3, 4]
value: 5
[1, 2, 3, 4, 5]
parent value: ["Think Visually", "Build Confidently"]
value: "Deploy Securely"
["Think Visually, Build Confidently, "Deploy Securely"]
parent value:
value:
Returns the number of items in an array
parent value
The array to count
[1, 2, 3, 4, 5]
2
[1, 2, 3, 4, 5]
5
These filters are used to compare arrays.
diff is used to show values from the first array that are not in the second array
intersect is used to show values from the first array that are in the second array
Use the basic filter for value arrays, and the _assoc version for arrays of objects.
parent value
The first array to compare
[1, 2, 3, 4, 5]
value
The second array to compare
Same as above
Using diff:
parent value: [1,2,3,4,5]
value: [3,4,5,6,7]
[1, 2]
Using diff_assoc: parent value:
value:
Using intersect:
parent value: [1,2,3,4,5]
value: [3,4,5,6,7]
[3, 4, 5]
Using intersect_assoc: parent value:
value:
Returns a new srray with only entries that are not empty.
An empty value can be []
, {}
, 0
, null
, ""
, or false
.
parent value
The array to filter
[1, 0, 2, 0, 3]
path
When filtering arrays of objects, you can specify a path to optionally use a specific key to judge emptiness.
[1, 0, 2, 0, 3]
[1, 2, 3]
Get the first entry of an Array.
parent value
The array to retrieve the first entry from
[1, 2, 3]
[1, 2, 3]
1
These filters are designed to remove the corresponding values from an object or an array. Useful in scenarios where something is sending data to your APIs that you don't have full control over, such as a frontend platform that always sends empty strings or null values.
parent value
The array or object to target
filter_empty_array
filter_empty_object
filter_empty_text
filter_false
filter_null
filter_zero
Flattens a multi-level array into a single-level array.
parent value
The array to flatten
Converts an array into a text string by joining each value and using a separator.
parent value
The array to join
["a", "b", "c"]
separator optional
The character or characters to place in between each array item
Can be any text value, or even a single empty space
parent value: ["a", "b", "c"]
separator: _
a_b_c
parent value: [1, 2, 3, 4, 5] separator:
12345
Get the last entry of an Array.
parent value
The array to get the last entry of
[1, 2, 3]
[1, 2, 3]
3
Merge two arrays or objects together and return the new item.
Use merge to merge single level data.
Use merge_recursive to merge multi-level data.
parent value
The first array to merge
[1, 2, 3]
value
The second array to merge
[4, 5, 6]
using merge
parent value: ["a", "b", "c"]
value: ["d", "e", "f"]
["a", "b", "c", "d", "e", "f"]
using merge_recursive
parent value:
value:
Pops the last element of the Array off and returns it.
Please note that Xano's pop filter does NOT remove the item from the array.
Push an element on to the beginning of an array
Push an element on to the end of an array
Returns array of values between the specified start/stop.
Remove any elements from the array that match the supplied value and return the new array
Use the path option to search inside of objects.
Use the strict option to determine how precise the filter is (for example, treating 100 and "100" the same)
Always returns an array. Uses the existing value if it is an array or creates an array of one element.
Shifts the first element off the Array and returns it.
Returns the array in a randomized order
Extracts and returns a section of an array
offset - what index should the slice start, starting at 0
length - how many items to slice
Sort an Array of elements with an optional path inside the element, sort type, and ascending/descending. Sort types include:
text - case-sensitive sort for text
itext - case-insensitive sort for text
number - to sort numerically
natural - case-sensitive sort that is alphanumerical and natural to humans
inatural - case-insensitive sort that is alphanumerical and natural to humans
Ascending order is performed with a true boolean. Descending order uses a false boolean.
The example below shows the difference between case-sensitivity sort with text and itext:
The example below shows how to use the number sort type:
The example below shows using the natural sorting option
Returns unique values of an Array. You can also use this filter with an array of objects by specifying a path to the key you would like to use to judge uniqueness.
Push an element to the beginning of an Array and return the new Array.
These filters are meant to be used when dealing with Object field types and are particularly useful if you are receiving a large object, from a webhook for example, where only a few of those records are required for your workflows. You can also use them with an array of objects by specifying a path to the key you would like to make changes to.
Pick: Identify values you would like to keep and the filter will return a new object containing only the values you have selected.
Unpick: Identify values you would like to exclude and the filter will return a new object containing only the fields that weren’t omitted.