Robbie Done
Robbie Done

Reputation: 1157

Rails + Read json from remote site

I was wondering if it is possible with rails to read in the json content of an external Joomla website?

Would I need to use Nokogiri to complete such a task?

Upvotes: 0

Views: 99

Answers (1)

vise
vise

Reputation: 13373

Well, Nokogiri is for parsing html. This is how you would do it plain ruby (in rails you probably don't even need to require those):

require 'open-uri'
require 'json'

response = open("http://path.to.website/file.json").read
JSON.parse(response)

Upvotes: 2

Related Questions