Tutorial Reading JSON in Python

Posted in Uncategorized

Tweet This Share on Facebook Bookmark on Delicious Digg this Submit to Reddit

Previously we done API fetching for PHP, now in this tutorial we will be reading JSON data in Python connecting to …

https://jsonplaceholder.typicode.com/todos/

to retrieve some dummy data related to hypothetical ToDo list.

After “pip install requests” you can import requests and use its “get” method like this…

Note the headers to request “application/json” format.

Now you can iterate through and extract out only the title like this …

If you want to pass query string parameters, such as to…

 https://jsonplaceholder.typicode.com/posts?userid=1

you can do …


Related Posts

Tags

Share This