Read JSONL line by line

This commit is contained in:
Václav Navrátil 2024-08-01 15:01:48 +02:00 committed by GitHub
parent 7dd1590399
commit 3fdca19d85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,7 +9,14 @@ if len(sys.argv) < 2:
relay = sys.argv[1]
data = json.loads(sys.stdin.read())
data = []
for line in sys.stdin:
try:
item = json.loads(line)
data.append(item)
except json.JSONDecodeError as e:
print(f"Error decoding JSON: {e}", file=sys.stderr)
continue
# Execute the binary for each element in the JSON array
for item in data: