Ruby - File IO
What is the output of this Ruby code?
require 'json'
json_str = '{"age":30,"city":"NY"}'
ruby_obj = JSON.parse(json_str)
puts ruby_obj["city"]What is the output of this Ruby code?
require 'json'
json_str = '{"age":30,"city":"NY"}'
ruby_obj = JSON.parse(json_str)
puts ruby_obj["city"]{"age":30,"city":"NY"} is parsed into a Ruby hash with keys "age" and "city".ruby_obj["city"] returns the string "NY".15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions