handle JSON.parse errors properly

JSON.parse can throw if an argument isn't json, and there's no way to catch this error outside of the library.