JSON + error framework

Added JSONObject to return as well as the framework for finding errors.