From 3f3454e9001c0ed021aa220b4f0e92aa48ac23ea Mon Sep 17 00:00:00 2001 From: SmartStake <59798479+SmartStake@users.noreply.github.com> Date: Mon, 12 Feb 2024 22:00:01 -0500 Subject: [PATCH] Create validate_json.py --- .github/scripts/validate_json.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/scripts/validate_json.py diff --git a/.github/scripts/validate_json.py b/.github/scripts/validate_json.py new file mode 100644 index 0000000..8643768 --- /dev/null +++ b/.github/scripts/validate_json.py @@ -0,0 +1,18 @@ +import json +import glob + +def validate_json(json_file): + try: + json.load(open(json_file, 'r')) + print(f"Valid JSON: {json_file}") + except ValueError as e: + print(f"Invalid JSON: {json_file}") + print(f"Error: {e}") + exit(1) + +if __name__ == "__main__": + print("starting json validation") + files = glob.glob('**/*.json', recursive=True) + for file in files: + validate_json(file) + print("after json validation")