From the course: Full Stack Web Development with Flask

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Sending a JSON response

Sending a JSON response

- Sending a JSON response. In this video, we're going to take a look at the response object and how to create two very simple APIs to send a JSON response. Recall that a response object is a class that is consist of about six parameters, and the three parameters you see in pink here are the most commonly used parameters. So let's go into the code and see how this is done. Now, let's go and do an example using the post, I mean the response. Now the response is a little bit tricky because again you'll only use that to create APIs. So, let's just say that I'm going to go and create an API and in the URL when I type in API it's going to pass me some data and show me some, and send me some data back to the requester, which is me, right. So, let's go in the code and do something like that. In here, I'm going to just write a very simple API to dump this course data back to the browser, or to the user, using the Response class.…

Contents