title: Checking if a string is valid json before trying to parse it?
body: <p>In Ruby, is there a way to check if a string is valid json before trying to parse it?</p>
  
  <p>For example getting some information from some other urls, sometimes it returns json, sometimes it could return a garbage which is not a valid response.</p>
  
  <p>My code:</p>
  
  <pre><code>def get_parsed_response(response)
    parsed_response = JSON.parse(response)
  end
  </code></pre>