Custom Object Helpers

May 9, 2025 ยท View on GitHub

These helpers provide some ability to query and manage objects.


Helpers.Object.GetIndex

SummaryGets the index of an object in an array
ReturnsThe index of the object if found
RemarksIf input is not an array, this will return nothing
Parameters
inputArray to get index of
objectObject 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

SummaryGets the length of an array
ReturnsNumber of elements in the inputted array
RemarksIf input is not an array, this will return 0
Parameters
inputArray 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

SummaryReturns the maximum value of a property inside of an array of objects
ReturnsThe maximum value found
RemarksIf 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
inputArray to search
propertyProperty 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

SummaryReturns the minimum value of a property inside of an array of objects
ReturnsThe minimum value found
RemarksIf 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
inputArray to search
propertyProperty 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

SummaryGets a serilized json representation of the object passed in
ReturnsJson object representing input
RemarksIf input is null, this will return null
Parameters
inputObject 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

SummaryReturns a json string after excluding the specified keys from the input dictionary. Keys to exclude are separated by |.
ReturnsJSON object with specified keys removed
RemarksIf input is null or not a dictionary, this returns null.
Parameters
inputDictionary object to filter
keysPipe-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"}