Add and streamline explicit error handling for JSON.parse response