Question #4 asks :
.json() method to access the decoded JSON data and store it in a variable called
r_json. Try printing out
r_json. Can you see the advantage working with
r_json has over
I don’t see any differences/advantages between the two. Can anyone explain what it is? It looks the same as one another except for having single quotes (json) vs double quotes (text). Not sure if this has any significance. Thanks!
Could you post your code for us to see? It can be a bit harder to help with out knowing for sure were you’re at
Specifically what is assigned to
r_json is what I’m getting at.
Without seeing your code I do have a hunch. Have you tried printing
type(r_json)? Are they both the same? Or could one be easier to work with?
Hi, sorry about that. Below is my code:
r = requests.get(‘https://api.census.gov/data/2020/acs/acs5?get=NAME,B08303_001E,B08303_013E&for=county:*&in=state:36’)
r_text = r.text
r_json = r.json()
Thank you much! Yep, that’s what I thought!
Try what I recommended earlier, should see a bit of a differnce
r_text is class str
r_json is class list