Skip to content

Commit 80adf39

Browse files
committed
Back port wmetcalf/FixUpFirstJsonScopeHandling
1 parent e497c94 commit 80adf39

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

docs/Zircolite_manual.pdf

3 Bytes
Binary file not shown.

zircolite.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ def __init__(self, config, logger=None, noOutput=False, timeAfter="1970-01-01T00
352352
self.timeField = timeField
353353
self.hashes = hashes
354354
self.delimiter = delimiter
355+
self.first_json_output = True # To manage commas in JSON output
355356

356357
def close(self):
357358
self.dbConnection.close()
@@ -565,7 +566,6 @@ def executeRuleset(self, outFile, writeMode='w', showAll=False,
565566
Execute all rules in the ruleset and handle output.
566567
"""
567568
csvWriter = None
568-
first_json_output = True # To manage commas in JSON output
569569
is_json_mode = not self.csvMode
570570

571571
# Prepare output file handle if needed
@@ -628,10 +628,10 @@ def executeRuleset(self, outFile, writeMode='w', showAll=False,
628628
# Write results as JSON using orjson
629629
try:
630630
# Handle commas between JSON objects
631-
if not first_json_output:
631+
if not self.first_json_output:
632632
fileHandle.write(',\n')
633633
else:
634-
first_json_output = False
634+
self.first_json_output = False
635635
# Serialize ruleResults to JSON bytes with indentation
636636
json_bytes = json.dumps(ruleResults, option=json.OPT_INDENT_2)
637637
# Write the decoded JSON string to the file

0 commit comments

Comments
 (0)