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

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -