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 Format:-
{
-get.friendlist: {
-friendslist: [
-{
id: "6"
first_name: "Jeyaprabhu"
last_name: "Palanichamy"
im_screen_na开发者_Python百科me: ""
email: "Jeyaprabu@abc.net"
password: "c4cce19cf6453c10754339a15cf9265d"
mobile: ""
date_of_birth: ""
gender: "male"
}
-{
id: "72"
first_name: "Saravanan"
last_name: "R"
im_screen_name: "Saravanan R"
email: "r.saravanan@abc.net"
password: "7cc2f5546b199421184a287bb75c406d"
mobile: ""
date_of_birth: "9/9/1985"
gender: "male"
}
]
}
}
Its not printing the value of first_name..
Try this..
<% @parsed_json['get.friendlist']["friendslist"].each do |json_output| %>
<%= json_output['first_name'] %>
<% end %>
精彩评论