ads_common/lib/ads_common/results_extractor.rb
def normalize_array_field(data, field_def)
      result = data
      # Convert a specific structure to a handy hash if detected.
      if check_key_value_struct(result)
        result = convert_key_value_to_hash(result).inject({}) do |s, (k,v)|
          s[k] = normalize_output_field(v, field_def)
          s
        end
      else
        result = data.map {|item| normalize_output_field(item, field_def)}
      end
      return result
    end
def normalize_array_field(data, field_def)
      result = data
      # Convert a specific structure to a handy hash if detected.
      if check_key_value_struct(result)
        result = convert_key_value_to_hash(result).inject({}) do |s, (k,v)|
          s[k] = normalize_output_field(v, field_def)
          s
        end
      else
        result = data.map {|item| normalize_output_field(item, field_def)}
      end
      return result
    end
Normalizes every item of an Array.