Custom Object Helpers
May 9, 2025 ยท View on GitHub
These helpers provide some ability to query and manage objects.
- Helpers.Object.GetIndex
- Helpers.Object.GetLength
- Helpers.Object.Max
- Helpers.Object.Min
- Helpers.Object.ToJson
- Helpers.Object.FilterKeys
Helpers.Object.GetIndex
| Summary | Gets the index of an object in an array |
| Returns | The index of the object if found |
| Remarks | If input is not an array, this will return nothing |
| Parameters | |
| input | Array to get index of |
| object | Object to lookup index of |
Example
Context
{
"array": [
"one",
"two",
"three"
]
}
Usage
<strong>result:</strong>
{{Helpers.Object.GetIndex array "two"}}
{{Helpers.Object.GetIndex array "one"}}
Returns
<strong>result:</strong>
1
0
Helpers.Object.GetLength
| Summary | Gets the length of an array |
| Returns | Number of elements in the inputted array |
| Remarks | If input is not an array, this will return 0 |
| Parameters | |
| input | Array to get length of |
Example
Context
{
"a": [],
"b": [
"one",
"two"
],
"c": [
1
],
"d": [
{
"id": 1
},
{
"id": 2
}
]
}
Usage
<strong>result:</strong>
{{Helpers.Object.GetLength a}}
{{Helpers.Object.GetLength b}}
{{Helpers.Object.GetLength c}}
{{Helpers.Object.GetLength d}}
Returns
<strong>result:</strong>
0
2
1
2
Helpers.Object.Max
| Summary | Returns the maximum value of a property inside of an array of objects |
| Returns | The maximum value found |
| Remarks | If input is not an array, this will return nothing |
| If no property is passed in, this will return the maximum value of the array that is passed in | |
| Parameters | |
| input | Array to search |
| property | Property to match on |
Example 1
Context
{
"array": [
1,
2,
3
]
}
Usage
<strong>result:</strong>
{{Helpers.Object.Max array}}
Returns
<strong>result:</strong>
3
Example 2
Context
{
"array": [
{
"id": 1,
"name": "test1",
"type": {
"id": 4,
"name": "type1"
}
},
{
"id": 2,
"name": "test2",
"type": {
"id": 5,
"name": "type2"
}
},
{
"id": 3,
"name": "test3",
"type": {
"id": 6,
"name": "type3"
}
}
]
}
Usage
<strong>result:</strong>
{{Helpers.Object.Max array "id"}}
{{Helpers.Object.Max array "type.id"}}
{{Helpers.Object.Max array "type.name"}}
Returns
<strong>result:</strong>
3
6
type3
Helpers.Object.Min
| Summary | Returns the minimum value of a property inside of an array of objects |
| Returns | The minimum value found |
| Remarks | If input is not an array, this will return nothing |
| If no property is passed in, this will return the minimum value of the array that is passed in | |
| Parameters | |
| input | Array to search |
| property | Property to match on |
Example 1
Context
{
"array": [
1,
2,
3
]
}
Usage
<strong>result:</strong>
{{Helpers.Object.Min array}}
Returns
<strong>result:</strong>
1
Example 2
Context
{
"array": [
{
"id": 1,
"name": "test1",
"type": {
"id": 4,
"name": "type1"
}
},
{
"id": 2,
"name": "test2",
"type": {
"id": 5,
"name": "type2"
}
},
{
"id": 3,
"name": "test3",
"type": {
"id": 6,
"name": "type3"
}
}
]
}
Usage
<strong>result:</strong>
{{Helpers.Object.Min array "id"}}
{{Helpers.Object.Min array "type.id"}}
{{Helpers.Object.Min array "type.name"}}
Returns
<strong>result:</strong>
1
4
type1
Helpers.Object.ToJson
| Summary | Gets a serilized json representation of the object passed in |
| Returns | Json object representing input |
| Remarks | If input is null, this will return null |
| Parameters | |
| input | Object to serialize |
Example
Context
{
"a": [],
"b": [
"one",
"two"
],
"c": [
1
],
"d": [
{
"id": 1
},
{
"id": 2
}
]
}
Usage
<strong>result:</strong>
{{Helpers.Object.ToJson d}}
Returns
<strong>result:</strong>
[{"id":1},{"id":2}]
Helpers.Object.FilterKeys
| Summary | Returns a json string after excluding the specified keys from the input dictionary. Keys to exclude are separated by |. |
| Returns | JSON object with specified keys removed |
| Remarks | If input is null or not a dictionary, this returns null. |
| Parameters | |
| input | Dictionary object to filter |
| keys | Pipe-separated (|) list of keys to exclude from the result |
Example
Context
{
"Condition": "New",
"VIN": "1234567890",
"StockNumber": "ABC123",
"Title": "2025 Ford F-150",
"Length Overall": "20 ft",
"Price": 45000,
"Color": "Blue"
}
Usage
<strong>result:</strong>
{{Helpers.Object.FilterKeys input "Condition|VIN|StockNumber|Title|Length Overall"}}
Returns
<strong>result:</strong>
{"Price":45000,"Color":"Blue"}