Store JSON in PostgreSQL column

Today I want to share with you how to store JSON object or array in PostgreSQL table column.

This problem is really easy to solve since the PostgreSQL has a native support for storing JSONs as Binary JSON or JSONB.

Just create a new column of type jsonb:
add_column :TABLE, :COLUMN_NAME, :jsonb

So whenever you want to store any Array or Hash, just store it in the ActiveRecord object like with any other column and then access it natively as Array or Hash.