Files
GS13/tools/json_verifier.py
2019-09-23 18:26:34 +02:00

20 lines
423 B
Python

import sys
import json
if len(sys.argv) <= 1:
exit(1)
files = filter(len, sys.argv[1].split('\n'))
msg = []
for file in files:
with open(file, encoding="ISO-8859-1") as f:
try:
json.load(f)
except ValueError as exception:
msg.append("JSON synxtax error on file: {}".format(file))
msg.append(str(exception))
if msg:
print("\n".join(msg))
exit(1)
exit(0)