how to get the JSON object through URL in my ruby on rails code:
url = "https://graph.facebook.com/me/friends?access_token=XXX"
I am not able to get good tutorial for JSON + Ruby on rails. Can someone help me out thanks.
require 'open-uri'
require 'json'
json_object = JSON.parse(open("https://graph.facebook.com/me/friends?access_token=XXX").read)
This is the simplest way, though it may not be the fastest.
Edit: If the URI contains special characters in its parameter string, it has to be escaped/encoded with URI.escape
first.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With