title: How to use the ActiveRecord json field type
body: <p>I have a Rails model which has a database column of type "json":</p>
  
  <pre><code>create_table "games", force: true do |t|
    t.json     "game_board"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end
  </code></pre>
  
  <p>Great!  Now how do I use it?  Is it really just as simple as <a href="http://blog.arkency.com/2014/10/how-to-persist-hashes-in-rails-applications-with-postgresql/" rel="noreferrer">treating the field like a <code>Hash</code></a>?</p>
  
  <pre><code>self.game_board[:player1] = 1
  self.game_board[:cards] = cards.to_hash
  </code></pre>
  
  <p>If I were to write that, would everything just work as expected, so in a future API call from a client I could do this?:</p>
  
  <pre><code>self.game_board[:player] # And get back the 1 that I put here before
  </code></pre>
  
  <p>What about performance as well?  Will the entire <code>game_board</code> be de-serialized every time even if that field is never read?  Will the field be re-written (IOW a database write) each time I change part of the "Hash?"</p>