I have a file called Output.json:
[
{
"name": "krishna",
"service": "postman",
"host": "xxxxxx",
"doing": [],
"pool": "xxxxxx",
"roleType": "yyyyy",
"simple": true
}
]
And this is my Test.rb file:
require 'rubygems'
require 'json'
require 'pp'
file = File.read('output.json')
data_hash= JSON.parse(file)
pp data_hash
When I try to run the script I get:
from /usr/lib/ruby/gems/1.8/gems/json-1.4.6/lib/json/common.rb:146:in `parse'
How do I print the value "krishna" when I call the name from the JSON file.