python 3.x - Loop json results -


i'm totally new python. have code:

import requests  won = 'https://api.pipedrive.com/v1/deals?status=won&start=0&api_token=xxxx'  json_data = requests.get(won).json()  deal_name = json_data ['data'][0]['title'] print(deal_name) 

it prints first title me, loop through titles in json. can't figure out how. can guide me in right direction?

you want read on dictionaries , lists. seems json_data["data"] contains list, so:

seeing wrote this:

deal_name = json_data ['data'][0]['title'] print(deal_name) 

what looking is:

for in range(len(json_data["data"])):     print(json_data["data"][i]["title"]) 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -