Skip to content

Instantly share code, notes, and snippets.

@abhishek0
Created August 14, 2013 13:06
Show Gist options
  • Save abhishek0/6230855 to your computer and use it in GitHub Desktop.
Save abhishek0/6230855 to your computer and use it in GitHub Desktop.
raw_data = JSON.parse(response.body)
@data = Hash.new{|h,k| h[k]=Hash.new(&h.default_proc) }
raw_data.each do |u|
# u["id"] actually prints u itself??
id = u["id"], name = u["first_name"], l = u["locality"], c = u["city"]
@data[id]["first_name"] = name
@data[id]["locality"] = l
@data[id]["city"] = c
@data[id][u["status"]] = u["count"]
end
this is the output when I do $stderr.puts u["id"]
{"id"=>"c7a776a4-04e1-11e3-871b-78843c9a3bc9", "first_name"=>"Roman", "locality"=>"Kevin Vista", "city"=>"North Frederickfort", "count"=>1, "status"=>"rejected"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment