Iterar json with Angular2

0

I am trying to iterate the json resulting from a call but I can not find a way. The json I read it in the following way:

  return this.http.get('http://localhost:4200/traerDatos.php').map(res => res.json()).subscribe(result => this.result = result);

And I save it in a variable such that.

    let resultado = this._recogeIdService.consultaId();

From here I do not know how to treat the result variable so that it shows me the content. An example of the% resulting json according to the Chrome console is as follows:

    
asked by Marchena14 01.06.2017 в 11:07
source

1 answer

-2

Have you tried like this?

this.resultado.forEach((obj) => {
  console.log(obj.id);
})  
    
answered by 01.06.2017 / 11:44
source