title: fetch json file then manipulate data with ruby
body: <p>I am using ruby version 2.0.0, I have a <code>demo.json</code> file which looks like this:</p>
  
  <pre><code>{ "demo": 
    { 
      "rama" : { "Name": "demo" },
      "krishna" : { "Name": "hare","place": "bharat", "hawa": { "maina": "tota"} } 
    }
  }
  </code></pre>
  
  <p>Now I try to manipulate json file by this way:</p>
  
  <pre><code>require 'json'
  options = {}
  options[:demo] = "kailash"
   File.open("demo.json","w") do |f|
  
      f.write(JSON.pretty_generate(options))
  
  end
  </code></pre>
  
  <p>I want to replace some values and to add some new key-value pairs in the existing <code>JSON</code> file and don't wants to completely replace the entire <code>JSON</code> file. Is there any way to do this?</p>