Adding more accurate error handling of JSON errors