Catch JSON.parse exceptions and raise errors. Closes #180.