I have been trying to load the file in the format '.json' with multiple lines i.e. it has the following format(arbitrary data):
data.json :
{"John" : "doe", "Age" : "Unknown"}
{"kat" : "doe", "Age" : "Unknown"}
{"Brian" : "doe", "Age" : "Known"}
I have tried the following lines of code which doesn't seem to be working.
dt = []
with open("data.json") as file:
for line in file.readlines():
temp = json.loads(line)
dt.append(temp)
print(dt)
I keep getting an empty list.
forloop block really not indented inside thewithblock? Because after removing the empty lines and fixing the indentation, your code seems to work: i.stack.imgur.com/2xREE.png - Gino Mempin