Q:

Convert text string into JSON array

I have a file with data written by a lua script that I am trying to convert into JSON. The data is formatted as follows:
{"ID" : 51, "name" : "John", "relationship" : "Friend", "Lat" : 56.166609, "Long" : 27.157364}
{"ID" : 52, "name" : "Sally", "relationship" : "Friend", "Lat" : 55.895501, "Long" : 26.753631}

I need to convert it to:
[
    {
"time" : 0.00, 
"ID" : 51, 
"name" : "John",
"relationship" : "Friend",
"Lat" : 56.166609, 
"Long" : 27.157364
},
{
    "time" : 0.00, 
    "ID" : 52, 
    "name" : "Sally",
    "relationship" : "Friend",
    "Lat" : 55.895501, 
    "Long" : 26.753631
    }
]

Currently I am trying the code below, which works with a single line of data but not with multiple lines of data. I haven't been able to figure out what additional steps are needed for multilpe lines (the actual data file will be hundreds of lines) :
        const response2 = await fetch('Export.log');
        var data2 = await response2.text();
        var formatted = JSON.parse(data2);
        console.log(formatted);

A:

Looks like you want to take data2 and do the following.
var formatted = JSON.parse('[' + data2.trim().replace(/\n/g, ',') + ']')

So take your data, replace all of the new lines with commas, and then wrap it in an array.
The trim is to take off a trailing new line if there are any.

