Q:

Rake db:seed you must pass a hash as an argument - Trying to insert json

I have this json file that I want to put into a database, here it is, http://pastebin.com/m3GsTfdi
This is the migration file for the table that I want to store this information in;
create_table :characters do |t|
  t.string :name
  t.string :region
  t.string :realm
  t.integer :class
  t.integer :race
  t.integer :level
  t.integer :achievementPoints
  t.string :items
  t.string :stats
  t.string :hunterPets
  t.string :talents
  t.string :progresison

  t.timestamps null: false
end

And this is how I'm trying to insert a character through seed.rb
JSON.parse(open("#{Rails.root}/app/assets/seed/netfive.json").read).each do |chardata|
  Character.create(chardata)
end

However I'm getting the error 
"ArgumentError: When assigning attributes, you must pass a hash as an argument."
when I run rake db:seed.
How should I fix it? I'm thinking it's something to do with I'm trying to save an array where it should be a string, but I'm not sure how else to do it.
Edit:
I managed to fix it doing the seed like this instead;
char_data = JSON.parse(File.read("#{Rails.root}/app/assets/seed/netfive.json"))
Character.new({
                     name:char_data['name'],
                     realm:char_data['realm'],
                     charClass:char_data['class'],
                     race:char_data['race'],
                     level:char_data['level'],
                     achievementPoints:char_data['achievementPoints'],
                     items:char_data['items'],
                     stats:char_data['stats'],
                     hunterPets:char_data['hunterPets'],
                     talents:char_data['talents'],
                     progression:char_data['progression'],
                 }).save

I did also use serialization that was previously linked in a comment.
Thank for the help!

A:

When you loop though the JSON, you will be looping through each key and value within the JSON. This is not what you want. You want to create one character from the data.
It would look something like this:
char_data = JSON.parse(File.read("#{Rails.root}/app/assets/seed/netfive.json"))
Character.create char_data

You will have to be careful with data types when you are doing this. i.e. You might have an issue saving items as a String. I would instead look at serializing that data. 
Here is a reference for serialization: http://apidock.com/rails/ActiveRecord/AttributeMethods/Serialization/ClassMethods/serialize

