Skip to content

Commit 217eb0f

Browse files
authored
Update json.py
1 parent 26a3bc0 commit 217eb0f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

pyt/formatters/json.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,16 @@ def report(
1717
"""
1818
TZ_AGNOSTIC_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
1919
time_string = datetime.utcnow().strftime(TZ_AGNOSTIC_FORMAT)
20-
21-
machine_output = {
22-
'generated_at': time_string,
23-
'vulnerabilities': [vuln.as_dict() for vuln in vulnerabilities]
24-
}
20+
try:
21+
machine_output = {
22+
'generated_at': time_string,
23+
'vulnerabilities': [vuln.as_dict() for vuln in vulnerabilities]
24+
}
25+
except:
26+
machine_output = {
27+
'generated_at': time_string,
28+
'vulnerabilities': [vuln for vuln in vulnerabilities]
29+
}
2530

2631
result = json.dumps(
2732
machine_output,

0 commit comments

Comments
 (0)