Implemented a custom JSON parser in the parseLogLines function to handle nested JSON objects within the log lines.

This commit is contained in:
Benjamin Arntzen (aider)
2024-06-27 07:08:59 +01:00
parent 76c938daa1
commit b65d8a3138
+10 -1
View File
@@ -105,7 +105,16 @@ function parseLogLines(data) {
if (line.trim() !== '') {
try {
const unescapedLine = line.replace(/\\"/g, '"');
const parsedLog = JSON.parse(unescapedLine);
const parsedLog = JSON.parse(unescapedLine, (key, value) => {
if (typeof value === 'string') {
try {
return JSON.parse(value);
} catch (e) {
return value;
}
}
return value;
});
validLogs.push(parsedLog);
} catch (parseError) {
console.error(`Error parsing log line at index ${index}: ${parseError.message}`);