RUBY parse data from json file ruby - Net-Raft.com

Welcome aboard! We are happy you are here and wish you good net-raft!




Just a Web Code Solution
join us

parse data from json file using ruby


 138

RUBY


0

require 'json'

file = File.read('C:/Users/mypc/Documents/NetBeansProjects/MyRuby/test/newjson.json') // windows localhost
data_hash = JSON.parse(file)

puts data_hash['lang']

// newjson.json
{
"lang" : "Ruby on Rails",
"url" : "https://www.ruby-lang.org/en/",
"comments" : {
"1":"ruby is the best",
"2":"ruby is crazy"
}
}


By        
The power of the user (%)
62%



The most helpful RUBY solutions

Get real client ip address using ruby ?Get real client ip address using ruby ?RUBY

Click to see more ...

  744     139

get logon server using rubyget logon server using rubyRUBY

Click to see more ...

  692     136

get values from nested json object using ruby get values from nested json object using ruby RUBY

Click to see more ...

  404     82

get client region using rubyget client region using rubyRUBY

Click to see more ...

  374     63

get computer name rubyget computer name rubyRUBY

Click to see more ...

  437     43

get client latitude and longitude using ruby get client latitude and longitude using ruby RUBY

Click to see more ...

  293     42

get user domain using rubyget user domain using rubyRUBY

Click to see more ...

  306     34

get client country using ruby get client country using ruby RUBY

Click to see more ...

  246     33

get keys from json file using ruby get keys from json file using ruby RUBY

Click to see more ...

  266     31

get client hostname using ruby get client hostname using ruby RUBY

Click to see more ...

  332     26

Welcome aboard!
We are happy you are here and
wish you good net-raft!