title: How to serialize/deserialize ruby hashes/structs with objects as keys to json
body: <p>I would like to dump a nested datastructure in ruby to json (I am aware of the Marshal module but I need a standard format) and be able to load/parse the datastructure again. Catch: I use structs (or easier for the example: hashes) as keys of hashes. Example:</p>
  
  <pre><code>require 'json'
  h = {{hello: 123} =&gt; 123}
  JSON.parse(JSON.generate(h)) #=&gt; {"{:hello=&gt;123}"=&gt;123}
  </code></pre>
  
  <p>So the problem is, that JSON.generate(h) serialises the key {:hello=>123} as a string and when I parse the result again, it remains a string.</p>
  
  <p>How can I solve this and regain the original structure after generate/parse?</p>