The current implementation will add a new JSON array object into the existing file, if file already existing. This leads to broken JSON and therefore can't be a desired behavior.
There are two alternatives:
Append to existing JSON array
Use a more complex JSON object as the file root and record each run as a new session
Just override the file
1 sounds wrong and leads to semantically wrong data, so for the sake of simplicity, I'd suggest using solution 3.
The current implementation will add a new JSON array object into the existing file, if file already existing. This leads to broken JSON and therefore can't be a desired behavior.
There are two alternatives:
1 sounds wrong and leads to semantically wrong data, so for the sake of simplicity, I'd suggest using solution 3.