how to read json object in python [duplicate]

You should pass the file contents (i.e. a string) to json.loads(), not the file object itself. Try this:

with open(file_path) as f:
    data = json.loads(f.read())
    print(data[0]['text'])

There’s also the json.load() function which accepts a file object and does the f.read() part for you under the hood.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)