public LiteralExpression getArrayIndex(int index) {
        List<Object> values = expectArrayValue();

        if (index < 0) {
            index = values.size() + index;
        }

        return index >= 0 && values.size() > index
                ? new LiteralExpression(values.get(index))
                : new LiteralExpression(null);
    }
Expects the value to be an array and gets the value at the given
index. If the index is negative, it is computed to the array
length minus the index. If the computed index does not exist,
a {@link LiteralExpression} with a null value is returned.

@param index Index to get from the array.
@return Returns the array value.
smithy-jmespath/src/main/java/software/amazon/smithy/jmespath/ast/LiteralExpression.java