0
response = Typhoeus::Request.get(API_SERVER_ADDRESS + "users/" + params[:id] +"/friends" + API_OAUTH_TOKEN)
@parsed_json = ActiveSupport::JSON.decode(response.body)
@parsed_json['get.friendlist']["friendslist"].each do |first_name, last_name|
p first_name
end
JSON格式: -需要幫助解析JSON
{
-get.friendlist: {
-friendslist: [
-{
id: "6"
first_name: "Jeyaprabhu"
last_name: "Palanichamy"
im_screen_name: ""
email: "[email protected]"
password: "c4cce19cf6453c10754339a15cf9265d"
mobile: ""
date_of_birth: ""
gender: "male"
}
-{
id: "72"
first_name: "Saravanan"
last_name: "R"
im_screen_name: "Saravanan R"
email: "[email protected]"
password: "7cc2f5546b199421184a287bb75c406d"
mobile: ""
date_of_birth: "9/9/1985"
gender: "male"
}
]
}
}
它不打印FIRST_NAME的價值..
什麼問題?什麼不工作?你期望代碼做什麼,它實際上在做什麼? – 2011-05-23 12:12:09
@Matt Ball它的First_name的打印值不是 – 2011-05-23 12:15:00