How to use ruby to parse the json response given by foursquare API How to use ruby to parse the json response given by foursquare API json json

How to use ruby to parse the json response given by foursquare API


This should work:

gem install httparty

then

require 'httparty'require 'json'response = HTTParty.get("https://api.foursquare.com/v2/venues/vid", :query => {:oauth_token => "abc"})json = JSON.parse(response.body)


RUBY is case sensitive.require 'json' # json must be lower case

JSON.parse()
for example JSON.parse(response.body) # JSON must be all upper-case