title: Angular 7 Only arrays and iterables are allowed issue with the code
body: <p>I am trying to display some json data and keep getting this error:</p>
  
  <p><strong>ERROR Error: Error trying to diff 'Leanne Graham'. Only arrays and iterables are allowed</strong></p>
  
  <p>Here is the code:</p>
  
  <p>The Data</p>
  
  <pre><code>{id: 1, name: "Leanne Graham"}
  </code></pre>
  
  <p>app.component.html</p>
  
  <pre><code>&lt;ul&gt;
    &lt;li *ngFor="let element of data"&gt;
      {{element.name}}
    &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>app.component.ts</p>
  
  <pre><code>export class AppComponent implements OnInit {
  
    data = [];
  
    constructor(private dataService: DataService) {}
  
    ngOnInit() {
  
      this.get_users_by_id(1);
  
    }
  
    get_users_by_id(id) {
      this.dataService.get_users_by_id(id).subscribe((res: any[]) =&gt; {
        this.data = res;
      });
    }
  
  }
  </code></pre>
  
  <p>And Finally the service part</p>
  
  <pre><code>get_users_by_id(id) {
      return this.http.get(this.baseUrl + '/users/' + id);
  }
  </code></pre>
  
  <p>How can I fix this?</p>