title: Storing nested Hashes in PostgreSQL with Rails 4 (and Hstore)
body: <p>I have a Rails app that aggregates a lot of data from Google API's. I store the JSON responses in MongoDB currently (so my Rails app has both pg and mongo). However, today, I've came across PostgreSQL Hstore extension, and I've decided to give it a try.</p>
  
  <p>Unfortunately, I've ran into a problem. JSON given by API's is multiple levels deep, so Ruby Hash after <code>JSON.parse</code> contains hashes, which contain new hashes. However, <code>Hstore</code> is string key/value store, and it only goes 1 level deep. So hashes within first hash just become strings.</p>
  
  <p>The really nasty hack I found to do is to <code>eval</code> the hashes that were turned into strings:</p>
  
  <pre><code>eval("{ "foo" =&gt; "bar" }")
  </code></pre>
  
  <p>I do not like this. Any tips on what to do? Should I keep using MongoDB or is there any better way to store multi-level deep hashes in PG?</p>