#217 - JSON parse exceptions are not wrapped like others

Updated the code to wrap all JSON exceptions.  Also refactored out common code.