Welcome aboard! We are happy you are here and wish you good net-raft!
require 'json'
file = File.read('C:/Users/mypc/Documents/NetBeansProjects/MyRuby/test/newjson.json') // windows localhost
data_hash = JSON.parse(file)
puts data_hash['comments']
// newjson.json
{
"lang" : "Ruby on Rails",
"url" : "https://www.ruby-lang.org/en/",
"comments" : {
"1":"ruby is the best",
"2":"ruby is crazy"
}
}
The most helpful RUBY solutions
Get real client ip address using ruby ?RUBY
Click to see more ...
738
139
get logon server using rubyRUBY
Click to see more ...
685
136
get values from nested json object using ruby RUBY
Click to see more ...
398
82
get client region using rubyRUBY
Click to see more ...
370
63
get computer name rubyRUBY
Click to see more ...
433
43
get client latitude and longitude using ruby RUBY
Click to see more ...
286
42
get user domain using rubyRUBY
Click to see more ...
300
34
get client country using ruby RUBY
Click to see more ...
239
33
get keys from json file using ruby RUBY
Click to see more ...
260
31
get client hostname using ruby RUBY
Click to see more ...
320
26