adding error handler to json parse