Added check for empty json in isValid method.