Unsubscribe doesn't working : I'm fetching the data from json file in services and subscribing it from my component. I'm doing some condition check with the data, once it matches I want to stop subscribing but it's not working, still its subscribing.

**Service**

    getUserData() {
    const url = './assets/json/userslist.json';
    return this.http.get(url);
  }

**Component**

    const subscription = this.getuser.getUserData().subscribe(data => {
      Object.values(data).forEach((userdetail) => {
        // tslint:disable-next-line:max-line-length
        if (userdetail.username.indexOf(form.value.email) !== -1 && userdetail.password == form.value.password) {
          console.log('asd');
          if (userdetail.active == true) {
            console.log('asasdfasd');
            this.EventEmitterObj.emit(form.value.email);
            this.router.navigateByUrl('/home');
          } else if (userdetail.active == false) {
            console.log('asd23423432');
            this.deactivateAlert = 'The account is deactivated';
          }
          subscription.unsubscribe();
          console.log('issue');
        } else {
          console.log('12341243');
          this.deactivateAlert = 'Incorrect Username/Password';
        }
      });
    });