Python Forum
Help with a for loop & json...
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with a for loop & json...
#2
This is what I came up with, which sort-of works.
   r=requests.get(url + id, headers=h, params=p)
    inbound_dict = {}
    inbound=json.loads(r.text)
    for item in inbound['messages']:
        inbound_dict[item['conversationId']] = item['body']
    print(inbound_dict)
Reply


Messages In This Thread
Help with a for loop & json... - by t4keheart - Feb-03-2020, 09:29 PM
RE: Help with a for loop & json... - by t4keheart - Feb-04-2020, 09:09 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Loop through json file and reset values [SOLVED] AlphaInc 2 2,259 Apr-06-2023, 11:15 AM
Last Post: AlphaInc
  Convert string to JSON using a for loop PG_Breizh 3 3,021 Jan-08-2021, 06:10 PM
Last Post: PG_Breizh

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020