def normalize_fields(data, fields)
      fields.each do |field|
        field_name = field[:name]
        if data.include?(field_name)
          field_data = data[field_name]
          field_data = normalize_output_field(field_data, field)
          field_data = check_array_collapse(field_data, field)
          data[field_name] = field_data unless field_data.nil?
        end
      end
      return data
    end
def normalize_fields(data, fields)
      fields.each do |field|
        field_name = field[:name]
        if data.include?(field_name)
          field_data = data[field_name]
          field_data = normalize_output_field(field_data, field)
          field_data = check_array_collapse(field_data, field)
          data[field_name] = field_data unless field_data.nil?
        end
      end
      return data
    end
Normalizes all fields for the given data based on the fields list
 provided.