Ruby JSON

Before you begin with encoding and translating JSON utilizing Ruby, you have to introduce any of the JSON modules accessible for Ruby. You might need to introduce Ruby jewel, yet in the event that you are running most recent variant of Ruby then you should have diamond as of now introduced on your machine, generally how about we take after the accompanying single step accepting you as of now have pearl introduced.

{
   "President": "Alan Isaac",
   "CEO": "David Richardson",
     "India": [
          "Virender  ",
      "Gautam  ",
   ],
   "Srilanka": [
       "Angelo Mathews",
      "Kumar Sangakkara"
   ],
   "England": [
       "Jonathan  ",
      "Kevin  "
   ]
}

Given below is a Ruby program that will be utilized to parse the aforementioned JSON report

#!/usr/bin/ruby
require 'rubygems'
require 'json'
require 'pp'

json = File.read('input.json')
obj = JSON.parse(json)
pp obj

Output -

{ "President"=>"Alan Isaac",
"CEO"=>"David Richardson",
"India"=>
["Virender ", "Gautam "],
"Srilanka"=>
["Angelo ", "Kumar "],
"England"=> ["Jonathan ", "Kevin "]
}