I am using ruby 1.9.3 and am receiving the following hash back from an API GET request:
puts api_response
{"id"=>"5172901-01", "firstName"=>"a", "lastName"=>"b", "email"=>"[email protected]", "gender"=>"U", "dateOfBirth"=>"1983-08-05"}
{"id"=>"2072902-01", "firstName"=>"c", "lastName"=>"d", "email"=>"[email protected]", "gender"=>"U", "dateOfBirth"=>"1955-04-01"}
{"id"=>"1072903-01", "firstName"=>"e", "lastName"=>"f", "email"=>"[email protected]", "gender"=>"M", "dateOfBirth"=>"1987-12-31"}
{"id"=>"2072817-04", "firstName"=>"g", "lastName"=>"h", "email"=>"[email protected]", "gender"=>"U", "dateOfBirth"=>"1985-04-07"}
How can i put each id into it's own array? Something like:
api_response[:id].each do |x|
api_response_array << x
end
The hashes aren't seperated by commas and I think that is what's throwing me off.
api_response? is it aHashor aString?