title: How to handle JSON parser errors in ruby
body: <p>How do I avoid parsing JSON if the response body will not be in JSON, else it throws a huge exception which I would like to handle</p>
  
  <pre><code>      def execute_method(foo)
  ...
  
          response = self.class.get("/foo.php", query: query)
          JSON.parse(response.body)
        end
  </code></pre>