import json import sys path = sys.argv[1] with open(path, 'r') as f: content = f.read() print(f"File has {content.count('{')} opening braces and {content.count('}')} closing braces") try: json.loads(content) print('Valid JSON') except Exception as e: print(f'Invalid JSON: {e}')