I have a .json file which contains a JSON item on every line. I want to try and count how many JSON items I have within the file using Python. I am currently just counting the lines using the following code
count =0
with open(file) as f:
for line in f:
count+=1
This seems like an unefficient way of doing it though. Is there a more efficient way of either calculating the number of JSON items in a .json file or counting the number of lines within a file?