title: Can't store array in json field in postgresql (rails) can't cast Array to json
body: <p>This is the error I'm getting when I run db:migrate</p>
  
  <pre><code>rake aborted!
  can't cast Array to json
  </code></pre>
  
  <p>This is my table     </p>
  
  <pre><code>  class CreateTrips &lt; ActiveRecord::Migration
  
            def change
              create_table :trips do |t|
  
                t.json :flights
                t.timestamps
              end
            end 
          end
  </code></pre>
  
  <p>This is in my seeds.rb file</p>
  
  <pre><code>flights = [{
      depart_time_hour: 600,
      arrive_time_hour: 700,
  
      passengers: [
          {
              user_id: 1,
              request: true    
          }
      ]
  }]
  
  trip = Trip.create(
    {
      name: 'Flight',
  
      flights: flights.to_json 
    }
  )
  </code></pre>
  
  <p>For some reason I can't do this.  If I do this.</p>
  
  <pre><code>trip = Trip.create(
        {
          name: 'Flight',
          flights: { flights: flights.to_json }
        }
      )
  </code></pre>
  
  <p>It works.  I don't want this though because now I have to access the json array with trip.flights.flights.  Not the behavior I'm wanting.</p>