def flatten(list)
    raise ArgumentError, list[0]['value'] if list[0] && list[0]['name'] == 'warning'
    raise ArgumentError, 'method parameter must respond to #each_pair' unless list.respond_to? :each_pair
    flat_list = {}
    list.each_pair do |k,v|
      flat_list[k.to_sym] = v["value"]
    end
    flat_list
  end
def flatten(list)
    raise ArgumentError, list[0]['value'] if list[0] && list[0]['name'] == 'warning'
    raise ArgumentError, 'method parameter must respond to #each_pair' unless list.respond_to? :each_pair
    flat_list = {}
    list.each_pair do |k,v|
      flat_list[k.to_sym] = v["value"]
    end
    flat_list
  end
Takes a hash like { "first_name" => {"name" => "first_name", "value" => "John"}}
 And flattens it into {"first_name" => "John"}