Skip to content

Instantly share code, notes, and snippets.

@wzph
Created October 1, 2008 23:53
Show Gist options
  • Save wzph/14238 to your computer and use it in GitHub Desktop.
Save wzph/14238 to your computer and use it in GitHub Desktop.
r = {"row"=>
[{"field"=>
[{"name"=>"id", "content"=>"1000000001"},
{"name"=>"name", "content"=>"Venue 1"},
{"name"=>"url", "content"=>"venue-1"},
{"name"=>"address_hint", "content"=>"MyString"},
{"name"=>"address_id", "content"=>"1000000001"},
{"name"=>"phone", "content"=>"(805) 555-1212"},
{"name"=>"capacity", "content"=>"MyString"},
{"name"=>"website", "content"=>"thewebsiteofawesome.com"},
{"name"=>"image", "content"=>"MyString"},
{"name"=>"description",
"content"=>
"Serving the coldest beer in downtown Las Vegas. Come by Keggy's Keg House to get drunk or as the locals like to say \"trashed\" in Las Vegas' seediest dive bar. Wednesdays are \"ladies night\" at Keggy's, so ladies bring your friends and don't forget you're picking up the beer tab for all the guys."},
{"name"=>"directions", "content"=>"MyText"},
{"name"=>"handicap_info", "content"=>"MyText"},
{"name"=>"handicap_availability", "content"=>"0"},
{"name"=>"custom_seattypes", "content"=>"MyText"},
{"name"=>"geocode_latitude", "content"=>"9.990000"},
{"name"=>"geocode_longitude", "content"=>"9.990000"},
{"name"=>"active", "content"=>"1"},
{"name"=>"created_at", "content"=>"2008-10-01 20:11:36"},
{"name"=>"updated_at", "content"=>"2008-10-01 20:11:36"},
{"name"=>"created_by_user_id", "content"=>"1000000001"},
{"name"=>"cached_postal_code_id", "xsi:nil"=>"true"},
{"name"=>"cached_reviews_rating", "xsi:nil"=>"true"},
{"name"=>"cached_reviews_rating_out_of", "xsi:nil"=>"true"}]}],
"xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance"}
hsh = {}
r['row'].each do |fields|
fields.each_pair do |f,field|
field.each do |row|
hsh[row['name']] = row['content']
end
end
end
puts hsh.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment