I have a list/dictionary which I'm trying to get the keys from.
Where I'm trying to print the keys is the get_keys() function, which is the part that needs fixing.
import json, io
business_json = "business.json"
def read_json(file):
    lines = [line for line in open(file)]
    js = [json.loads(line) for line in lines]
    for item in js:
        name = item.get("name")
    return js
def get_keys(data):
    for key in data.keys():
        print(key)
def get_values_for_category(data, category):
    values = []
    for item in data:
        values.append(item.get(category))
    return values
def main():
    json_data = read_json(business_json) #works
    names = get_values_for_category(json_data, "name") #works 
    get_keys(json_data)
if __name__ == "__main__":
    main()
The error I get with above's get_keys(data) is:
AttributeError: 'list' object has no attribute 'keys'
If I instead try:
for key, val in data.items():
    print(key, val)
or
for key in list(data).keys() or for key in list(data.keys()) I get same issue.
So, I have a list and need the keys. However, all the ways I've found to get a lists' keys returns an error.
Is it an issue with how I'm getting js in the read_json() function?  I'm confused as to why I can use a key ("name") to get values, but can't return the various keys I can look up...
EDIT: Full traceback is:
Traceback (most recent call last):
    File "D:\Batman\Documents\- Datasets\yelp_dataset\dataset\Yelp_analysis.py", line 29, in <module>
        main()<br>
    File "D:\Batman\Documents\- Datasets\yelp_dataset\dataset\Yelp_analysis.py", line 25, in main
        get_keys(json_data)<br>
    File "D:\Batman\Documents\- Datasets\yelp_dataset\dataset\Yelp_analysis.py", line 13, in get_keys
        for key in data.keys():<br> 
AttributeError: 'list' object has no attribute 'keys'
(FWIW a summary of the .json file is here and a snippet of the data is here on PasteBin).
 
     
    