0
I have a problem, I need to transform a JSON object that I receive from my backend to an object.
I’m getting this JSON
{"content": [{"id": 1, "nomebd": "teste", "email": "[email protected]"}, {"id": 2, "nomebd": "oi", "email": "oi"}, {"id": 3, "nomebd": "joao", "email": "tg"}, {"id": 4, "nomebd": "joao1", "email": "tg1"}, {"id": 5, "nomebd": "kkkkk", "email": "kkk"}, {"id": 6, "nomebd": "dae", "email": "dae"}, {"id": 7, "nomebd": "coe", "email": "coe"}, {"id": 8, "nomebd": "dadadad", "email": "dadadadada"}]}
by using the following code
this.service.getConfig()
.subscribe(dados => this.cursos = dados)
getConfig() comes from my service which is
getConfig() {
return this.http.get<Curso[]>(this.url)
}
I would like to know how to transform this json into an object to read with *ngFOR in ANGULAR
He is already converted. Try to do so:
this.service.getConfig().subscribe(dados => this.cursos = dados.content)
– wldomiciano