Python Forum
Issues parsing the response from a request
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issues parsing the response from a request
#2
>>> my_json = {u'data': [{u'count': 43.0, u'buttonColor': u'Yellow'}]}
>>> my_json['data'][0]['count']
43.0
>>> 
note that if there are more than one item in the data list you will need to iterate over them
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
RE: Issues parsing the response from a request - by buran - May-11-2019, 06:05 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  request.get to read large response pythonlearner1 7 3,328 Apr-05-2022, 08:21 PM
Last Post: pythonlearner1
  how can I correct the Bad Request error on my curl request tomtom 8 5,154 Oct-03-2021, 06:32 AM
Last Post: tomtom
  Unable to convert request response. johnboy1974 4 3,139 Apr-05-2021, 10:10 AM
Last Post: snippsat
  Empty response to request causing .json() to error t4keheart 1 10,196 Jun-26-2020, 08:35 PM
Last Post: bowlofred
  ImportError: cannot import name 'Request' from 'request' abhishek81py 1 3,983 Jun-18-2020, 08:07 AM
Last Post: buran
  Parsing Soap XML response grootkarzijn 7 15,705 Jun-14-2019, 01:30 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

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