Operations (sample payloads)

Main operations
Copy

Add item to list
Copy

Adds an item to the end of a list. If this list doesn't already exist, then a new list will be returned with just the new item.

Sample Input

1
{
2
"list": [
3
"apple",
4
"banana",
5
"cherry"
6
],
7
"item": "date",
8
"unique": true
9
}

Sample Output

1
{
2
"result": [
3
"apple",
4
"banana",
5
"cherry",
6
"date"
7
]
8
}

Add multiple items to list
Copy

Adds multiple items to the end of a list. If this list doesn't already exist, then a new list will be returned with just the new items.

Sample Input

1
{
2
"list": [
3
"apple",
4
"banana",
5
"cherry"
6
],
7
"items": [
8
"date",
9
"elderberry",
10
"fig"
11
],
12
"unique": true
13
}

Sample Output

1
{
2
"result": [
3
"apple",
4
"banana",
5
"cherry",
6
"date",
7
"elderberry",
8
"fig"
9
]
10
}

Chunk
Copy

Split a list of items into lists of a fixed size. If the list can’t be split evenly, the final chunk will be the remaining elements.

Sample Input

1
{
2
"list": [
3
"apple",
4
"banana",
5
"cherry",
6
"date",
7
"elderberry",
8
"fig",
9
"grape"
10
],
11
"size": 3
12
}

Sample Output

1
{
2
"size": 3,
3
"result": [
4
[
5
"apple",
6
"banana",
7
"cherry"
8
],
9
[
10
"date",
11
"elderberry",
12
"fig"
13
],
14
[
15
"grape"
16
]
17
]
18
}

Concatenate
Copy

Concatenate two lists together, adding all of the items from the second list after the items in the first list.

Sample Input

1
{
2
"list": [
3
"apple",
4
"banana",
5
"cherry"
6
],
7
"list_two": [
8
"date",
9
"elderberry",
10
"fig"
11
]
12
}

Sample Output

1
{
2
"result": [
3
"apple",
4
"banana",
5
"cherry",
6
"date",
7
"elderberry",
8
"fig"
9
]
10
}

Contains
Copy

Returns true if the match item in contained in the list, false otherwise.

Sample Input

1
{
2
"list": [
3
"apple",
4
"banana",
5
"cherry",
6
"date"
7
],
8
"match": "banana"
9
}

Sample Output

1
{
2
"result": true
3
}

Count items
Copy

Counts up the number of items (or length) in the list.

Sample Input

1
{
2
"list": [
3
"apple",
4
"banana",
5
"cherry",
6
"date",
7
"elderberry"
8
]
9
}

Sample Output

1
{
2
"result": 5
3
}

Delete items from list
Copy

Delete all items from a list that match a condition.

Sample Input

1
{
2
"list": [
3
"apple",
4
"banana",
5
"cherry",
6
"date",
7
"elderberry"
8
],
9
"conditions": [
10
{
11
"string_type": {
12
"comparison_type": "contains",
13
"value": "a"
14
}
15
},
16
{
17
"string_type": {
18
"comparison_type": "!==",
19
"value": "cherry"
20
}
21
}
22
],
23
"strictness": "all"
24
}

Sample Output

1
{
2
"removed": true,
3
"result": [
4
"apple",
5
"banana",
6
"date"
7
]
8
}

Difference
Copy

For a given list, filter it down to only return the items that do NOT exist in the second list.

Sample Input

1
{
2
"list": [
3
"apple",
4
"banana",
5
"cherry",
6
"date",
7
"elderberry"
8
],
9
"list_two": [
10
"banana",
11
"date",
12
"fig"
13
]
14
}

Sample Output

1
{
2
"result": [
3
"apple",
4
"cherry",
5
"elderberry"
6
]
7
}

Filter
Copy

Use filter conditions to filter a list of objects.

Sample Input

1
{
2
"list": [
3
{
4
"name": "John",
5
"age": 30,
6
"city": "New York"
7
},
8
{
9
"name": "Alice",
10
"age": 25,
11
"city": "Los Angeles"
12
},
13
{
14
"name": "Bob",
15
"age": 35,
16
"city": "Chicago"
17
},
18
{
19
"name": "Emma",
20
"age": 28,
21
"city": "New York"
22
}
23
],
24
"filter_type": "inclusive",
25
"conjunction": "OR",
26
"filters": [
27
{
28
"age": 30
29
},
30
{
31
"city": "New York"
32
}
33
]
34
}

Sample Output

1
{
2
"result": [
3
{
4
"name": "John",
5
"age": 30,
6
"city": "New York"
7
},
8
{
9
"name": "Emma",
10
"age": 28,
11
"city": "New York"
12
}
13
]
14
}

Find object in list
Copy

From a list of objects, pick the first object that matches the fields in the match object.

Sample Input

1
{
2
"list": [
3
{
4
"id": 1,
5
"name": "John Doe",
6
"age": 30,
7
"city": "New York"
8
},
9
{
10
"id": 2,
11
"name": "Jane Smith",
12
"age": 25,
13
"city": "Los Angeles"
14
},
15
{
16
"id": 3,
17
"name": "Bob Johnson",
18
"age": 35,
19
"city": "Chicago"
20
}
21
],
22
"object_conditions": [
23
{
24
"key": "age",
25
"value": 25
26
},
27
{
28
"key": "city",
29
"value": "Los Angeles"
30
}
31
]
32
}

Sample Output

1
{
2
"result": {
3
"id": 2,
4
"name": "Jane Smith",
5
"age": 25,
6
"city": "Los Angeles"
7
}
8
}

First
Copy

Given a list of items, get the first one.

Sample Input

1
{
2
"list": [
3
42,
4
17,
5
99,
6
3,
7
7
8
],
9
"error_on_empty": false
10
}

Sample Output

1
{
2
"result": 42
3
}

Get item by index
Copy

Given a list of items, retrieve the one at a specified index.

Sample Input

1
{
2
"list": [
3
"apple",
4
"banana",
5
"cherry",
6
"date",
7
"elderberry"
8
],
9
"index": 2,
10
"default_value": "Not found",
11
"index_error": false,
12
"error_on_empty": false
13
}

Sample Output

1
{
2
"result": "cherry"
3
}

Get list of page numbers
Copy

Get a list of "page numbers", given a total count, along with the number of items you would like to have in each page. For example, if you had 300 records and 100 per page, the list "[1,2,3]" would be returned.

Sample Input

1
{
2
"total_count": 300,
3
"per_page": 50
4
}

Sample Output

1
{
2
"result": [
3
1,
4
2,
5
3,
6
4,
7
5,
8
6
9
]
10
}

Get numbers between
Copy

Given a minimum and maximum value, get a list of all of the numbers in between the two. Includes both the minimum and maximum numbers too.

Sample Input

1
{
2
"min": 5,
3
"max": 10
4
}

Sample Output

1
{
2
"result": [
3
5,
4
6,
5
7,
6
8,
7
9,
8
10
9
]
10
}

Get unique items by key
Copy

Given a list of objects, retrieve a unique list of objects, excluding duplicate values for a specific key.

Sample Input

1
{
2
"list": [
3
{
4
"id": 1,
5
"name": "John Doe",
6
"department": "Sales"
7
},
8
{
9
"id": 2,
10
"name": "Jane Smith",
11
"department": "Marketing"
12
},
13
{
14
"id": 3,
15
"name": "Bob Johnson",
16
"department": "Sales"
17
},
18
{
19
"id": 4,
20
"name": "Alice Brown",
21
"department": "Marketing"
22
}
23
],
24
"key": "department"
25
}

Sample Output

1
{
2
"result": [
3
{
4
"id": 1,
5
"name": "John Doe",
6
"department": "Sales"
7
},
8
{
9
"id": 2,
10
"name": "Jane Smith",
11
"department": "Marketing"
12
}
13
]
14
}

Intersection
Copy

For two given lists, return only the items that exist in both lists.

Sample Input

1
{
2
"list": [
3
1,
4
2,
5
3,
6
4,
7
5,
8
6
9
],
10
"list_two": [
11
4,
12
5,
13
6,
14
7,
15
8,
16
9
17
]
18
}

Sample Output

1
{
2
"result": [
3
4,
4
5,
5
6
6
]
7
}

Iterative transform
Copy

Given a list, iterates through the enumerable components, and transforms the associated values accordingly.

Sample Input

1
{
2
"list": [
3
"hello world",
4
"SAMPLE TEXT",
5
"camelCase_example",
6
" trim me ",
7
"snake_case_string"
8
],
9
"transform_value": "upperCase"
10
}

Sample Output

1
{
2
"list": [
3
"HELLO WORLD",
4
"SAMPLE TEXT",
5
"CAMELCASE_EXAMPLE",
6
" TRIM ME ",
7
"SNAKE_CASE_STRING"
8
]
9
}

Join
Copy

Join all items in a list together as a string, separated by a separator.

Sample Input

1
{
2
"list": [
3
"apple",
4
"banana",
5
"cherry",
6
42,
7
true,
8
[
9
"grape",
10
"orange"
11
]
12
],
13
"separator": " - "
14
}

Sample Output

1
{
2
"result": "apple - banana - cherry - 42 - true - grape,orange"
3
}

Last
Copy

Given a list of items, get the last one.

Sample Input

1
{
2
"list": [
3
"apple",
4
"banana",
5
"cherry",
6
"date",
7
"elderberry"
8
],
9
"error_on_empty": false
10
}

Sample Output

1
{
2
"result": "elderberry"
3
}

Pluck
Copy

Given a list of objects, extracts the value of a specific key from each one, returning a flat list of the values for all objects.

Sample Input

1
{
2
"list": [
3
{
4
"id": 1,
5
"name": "John Doe",
6
"email": "john@example.com"
7
},
8
{
9
"id": 2,
10
"name": "Jane Smith",
11
"email": "jane@example.com"
12
},
13
{
14
"id": 3,
15
"name": "Bob Johnson",
16
"email": "bob@example.com"
17
}
18
],
19
"key": "email"
20
}

Sample Output

1
{
2
"result": [
3
"john@example.com",
4
"jane@example.com",
5
"bob@example.com"
6
]
7
}

Remove duplicates
Copy

Ensures that every item in a list exists once, and only once. Removes any duplicate values.

Sample Input

1
{
2
"list": [
3
"apple",
4
"banana",
5
"orange",
6
"apple",
7
"grape",
8
"banana",
9
"kiwi",
10
"orange"
11
]
12
}

Sample Output

1
{
2
"result": [
3
"apple",
4
"banana",
5
"orange",
6
"grape",
7
"kiwi"
8
]
9
}

Rename keys
Copy

Renames all keys in a list of objects.

Sample Input

1
{
2
"list_of_objects": [
3
{
4
"first_name": "John",
5
"last_name": "Doe",
6
"age": 30
7
},
8
{
9
"first_name": "Jane",
10
"last_name": "Smith",
11
"age": 25
12
}
13
],
14
"list_of_keys": [
15
{
16
"original_key": "first_name",
17
"new_key": "given_name"
18
},
19
{
20
"original_key": "last_name",
21
"new_key": "family_name"
22
}
23
]
24
}

Sample Output

1
{
2
"result": [
3
{
4
"given_name": "John",
5
"family_name": "Doe",
6
"age": 30
7
},
8
{
9
"given_name": "Jane",
10
"family_name": "Smith",
11
"age": 25
12
}
13
]
14
}

Reverse
Copy

Reverse the order of a list.

Sample Input

1
{
2
"list": [
3
"apple",
4
"banana",
5
"cherry",
6
"date",
7
"elderberry"
8
]
9
}

Sample Output

1
{
2
"result": [
3
"elderberry",
4
"date",
5
"cherry",
6
"banana",
7
"apple"
8
]
9
}

Rotate first item
Copy

Takes the first item of the list and puts it at the back.

Sample Input

1
{
2
"list": [
3
"apple",
4
"banana",
5
"cherry",
6
"date",
7
"elderberry"
8
]
9
}

Sample Output

1
{
2
"result": [
3
"banana",
4
"cherry",
5
"date",
6
"elderberry",
7
"apple"
8
]
9
}

Simple sort
Copy

Sorts a list of strings and / or numbers in ascending or descending order.

Sample Input

1
{
2
"list": [
3
"apple",
4
"banana",
5
"cherry",
6
"date",
7
"elderberry"
8
],
9
"order": "descending"
10
}

Sample Output

1
{
2
"result": [
3
"elderberry",
4
"date",
5
"cherry",
6
"banana",
7
"apple"
8
]
9
}

Slice
Copy

Creates a slice of the list from start up to, but not including, end.

Sample Input

1
{
2
"list": [
3
"apple",
4
"banana",
5
"cherry",
6
"date",
7
"elderberry"
8
],
9
"start": 1,
10
"end": 4
11
}

Sample Output

1
{
2
"result": [
3
"banana",
4
"cherry",
5
"date"
6
]
7
}

Sort objects
Copy

Given the inputs list, key and order ("ascending", "descending"), sort the object by the specified key in the desired order.

Sample Input

1
{
2
"list": [
3
{
4
"name": "John",
5
"age": 30,
6
"city": "New York"
7
},
8
{
9
"name": "Alice",
10
"age": 25,
11
"city": "Los Angeles"
12
},
13
{
14
"name": "Bob",
15
"age": 35,
16
"city": "Chicago"
17
}
18
],
19
"key": "age",
20
"order": "ascending"
21
}

Sample Output

1
{
2
"result": [
3
{
4
"name": "Alice",
5
"age": 25,
6
"city": "Los Angeles"
7
},
8
{
9
"name": "John",
10
"age": 30,
11
"city": "New York"
12
},
13
{
14
"name": "Bob",
15
"age": 35,
16
"city": "Chicago"
17
}
18
]
19
}

Zip
Copy

Takes a list of keys and a second list of values and returns a single object with corresponding key value pairs.

Sample Input

1
{
2
"list": [
3
"name",
4
"age",
5
"city"
6
],
7
"list_two": [
8
"John Doe",
9
30,
10
"New York"
11
]
12
}

Sample Output

1
{
2
"result": {
3
"name": "John Doe",
4
"age": 30,
5
"city": "New York"
6
}
7
}