Error trying to read backup json log file with python (on Windows)

Running Windows 10, restic 0.9.6 I can read the output of
“snapshots --json”
“backup -v -vv --json” does not seem to give a json compatible output that the simple python will read.
import json
with open(readfile, “r”) as read_file:
data = json.load(read_file) # returns a list of dictionaries.
Has anyone else tried to read the json formatted log files with python?
I was thinking of picking out the files which are locked and reporting those errors. Also might do a diff style of report when combined with the previous log. Thanks. This is not super important to me but am puzzled why it is not working.

The backup command provides a stream of json messages. Basically every line of the output is a separate json object. If I remember correctly, the python library doesn’t like a list of objects that are just separated by a newline. It should work though if you split the output on line endings beforehand.

Thanks. That info worked perfectly. I had been thinking the log file would be one json object but each line is a separate json object. So this now works as a too simple example of what type of data is in the log file:

> import json
> from collections import Counter
> readstr=r"K:\utility\restic\restic_d20200324_C.log"
> c = Counter()
> with open(readstr, "r", encoding='utf-8') as readfile:
>     for line in readfile:
>         start = line.find('{')
>         if start >= 0:
>             data = json.loads(line[start:])  # returns a dictionary.
>             for k in data:
>                 c[k] += 1 # count each key of the json
> ## print summary of what json keys were found and their count
> for key in sorted(c):
>         print (f"{key}: {c[key]}")