Check if definitions are undefined before running JSON.parse