-1

I am using Rails 4.2 with Ruby 2.1.5.

Let's say I have a textarea can have users input some data in JSON format as below.

{ 
   "City" : "Japan", 
   "Population" : "20M"
}

What should I do to deal with this data in JSON format so I can re-use it to display again in JSON format in the future?

How do I store it in my database or any other way can do it?

Roman C
  • 49,761
  • 33
  • 66
  • 176
Dreams
  • 8,288
  • 10
  • 45
  • 71

1 Answers1

0

If you are using PostgreSQL you can use the JSON columns.

See the docs on JSON with PostgreSQL.

Otherwise, if you are using other relational database (MySQL, Sqlite) use text/blob columns.

Bill
  • 3,059
  • 3
  • 31
  • 47