Ionic 4 HTTP GET Request Eample Using Random User API

This tutorial explains how to make HTTP GET requets using the random user api.

1 Like

Hi, I tried this using and it doesn’t work. Was wondering if anything needs to change? I used {{x.body}}to try and get the body information displayed but nothing displays. How do you get the data if it isn’t stored in the results key? this.usersList=data["results"]

First, you have to understand the JSON format, which is returned from the URL. Then only you are able to process it. In my example, I have result as key. That’s why i used data[“results”].

But in your example, the returning JSON format is an array of object. So there is no need to call the data[“results”]. You can directly use the data object like below in your ts file.


1 Like