How to loop through array in Logstash?

One option would be to use a split filter to split that event into multiple events which each have a [contents] field which is a hash rather than an array. If you need to, you can then recombine them into a single event.

The other option is to iterate over the array in a ruby filter.

ruby {
    code => '
        c = event.get("contents")
        if c.is_a? Array
            c.each { |x|
            if x["eligible"]
                resp = x["rawResponse"]
                value = ...
                event.set("rawResponse", value)
            end
        end
    '
}

You would have to figure out what to replace the ... with by repurposing code from the cipher filter.