Link: https://www.codecademy.com/journeys/data-scientist-ml/paths/dsmlcj-22-data-science-foundations/tracks/dsmlcj-22-python-fundamentals-for-data-science-part-ii/modules/dsf-data-acquisition-52c834f4-c0ab-482e-b463-0687222c2b26/lessons/overview-data-acquisition-methods/exercises/making-api-request-in-python
Question #4 asks :
"Use the .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 r_text
?"
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!
Howdy!
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_text
and r_json
is what I’m getting at.
Without seeing your code I do have a hunch. Have you tried printing type(r_text)
and type(r_json)
? Are they both the same? Or could one be easier to work with?
1 Like
Hi, sorry about that. Below is my code:
“”"
import requests
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
print(r_text)
r_json = r.json()
print(r_json)
“”"
1 Like
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
Thanks!
2 Likes