I use 'gem json' and need load JSON data from some url, for example:
"http://locallhost:3000/qwerty/give_json.json" with
{"one":"Omg","two":125,"three":"Hu"}
I have rails app
class QwertyController < ApplicationController
require 'json'
def get_json
source = "http://localhost:3000/qwerty/give_json.json"
@data = JSON.parse(JSON.load(source))
end
end
I get error
JSON::ParserError in QwertyController#get_json
795: unexpected token at 'http://localhost:3000/qwerty/give_json.json'
In string: @data = JSON.parse(JSON.load(source))
What is the matter? How can I get JSON data and parse it? I try @data["one"] ...