Fixes #235 - Return a proper error message when JSON payload is malformed.