returns only the comments as a list from the ‘comments’ json list of dictionaries. Wouldn’t it just return the 2nd element?
Understanding the data from json .get requests are a nightmare in general so is there any resources i can look up to make further sense of the most common formats that gets dumped from API get requests?
First, I ask you to always paste the link for the mission in your topic as it makes it easier for those trying to answer your question. You can see how to do this and more in the Technical Question Guidelines.
Answering your question:
comments is a list full of dictionaries. Therefore, comments[1] is a dictionary. This dictionary contains 2 keys: data and kind. You are accessing the data key. The value represented by this key is also a dictionary from which you are accessing the children key. With this said:
It does return only the second element. But this element is a dictionary containing all the comments the post has received. The comments are stored in the children key of the dictionary that is stored in the data key of the dictionary that is the second element of comments list. Confusing, yes, I know.
Also, keep in mind that the comments list refers to a single Reddit post.