Skip to content

Instantly share code, notes, and snippets.

@peterkappus
Created May 23, 2012 13:39
Show Gist options
  • Save peterkappus/2775273 to your computer and use it in GitHub Desktop.
Save peterkappus/2775273 to your computer and use it in GitHub Desktop.
Get JSON: Simple wrapper to get JSON from a URL
require 'json'
require 'net/http'
def get_json(url)
JSON.parse(Net::HTTP.get_response(URI.parse(url)).body)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment