Fix raising and testing of error on invalid JSON in response.
Merge pull request #38 from dpiddy/fix-json-parse-exception

Fix raising and testing of error on invalid JSON in response.