title: How do I get my data from my DB as a variable?
body: <p>I am using Angular, Spring Boot and Mongo DB.</p>
  <pre><code>ngOnInit(): void {
      this.LoginService.getLoginList().subscribe(data =&gt; {
  
        this.login = data;
  
        alert(JSON.stringify(data));
  
  
      });
  </code></pre>
  <p>When I put an alert  in typescript, I get this on my alert,</p>
  <p><code>[{&quot;username&quot;:&quot;user123&quot;,&quot;pass&quot;:&quot;pass@123&quot;}]</code></p>
  <p>And if I don't Stringify it I get,</p>
  <p>[object Object]</p>
  <p>I have try to use the variable as,</p>
  <pre><code>this.login.username
  login.username
  data.username
  </code></pre>
  <p>but nothing seems to work and I keep getting</p>
  <p><code>undefined</code></p>
  <p>on my alert.</p>
  <p>How do I save the data I am getting in JSON format to a variable?</p>