Json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| require 'net/http'
require 'uri'
require 'json'
uri = URI.parse('http://www.example.com/sample.json')
json = Net::HTTP.get(uri)
result = JSON.parse(json)
puts result
hash = Hash.new
hash[title] = link
File.open("/tmp/matsu_ship.json","w") do |f|
f.write(JSON.pretty_generate(hash))
end
p hash = JSON.parse(IO.binread("/tmp/matsu_ship.json"))
|