-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05101f0
commit 3f3454e
Showing
1 changed file
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") |