title: Convert JSON string to hash
body: <p>I have a Ruby on Rails JSON question.</p>
  
  <p>I have what I think is a strange error. I have the following JSON string which I get like this from an external API</p>
  
  <pre><code>test = "[{'domain': 'abc.com'}, {'domain': 'def.com'}, {'domain': 'ghi.com'}]"
  </code></pre>
  
  <p>Now, I want to convert this string to a hash using:</p>
  
  <pre><code>hash = JSON.parse test
  </code></pre>
  
  <p>The problem is that it errors with:</p>
  
  <pre><code>JSON::ParserError: 419: unexpected token at '{'domain': 'abc.com'}, {'domain': 'def.com'}, {'domain': 'ghi.com'}]'
  </code></pre>
  
  <p>The problem now with just replacing ' with " is dangerous if any strings includes ' or ". Anyone have a solution?</p>