From the course: Introduction to Web APIs

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Access data in the response

Access data in the response - REST Tutorial

From the course: Introduction to Web APIs

Access data in the response

- [Instructor] Now that we're able to filter and sort response data, let's see how we access specific parts of the data. Let's click the dropdown arrow here next to our first product. This will open it up so we can see all the data for this one product. As we talked about previously, with JSON, we have our data displayed in key value pairs. So here we see the keys. ID, description, image, price, name, et cetera. Remembering that these products are objects, we access the keys or properties within the object using dot notation. As I said before, it helps me to think of dot notation to access properties in a response like finding a file on a computer. It's similar to a file path that digs through directories and sub directories to get to the information that we want. Instead of slashes, we use dots. So let's do that. Let's use dot notation to get only the description for the first item and print it to the console. After…

Contents