import json import re import traceback try: with open(r'C:\Users\KIIT0001\.gemini\antigravity\brain\11fe738c-0bc1-48e6-88bd-c54041a22f85\.system_generated\logs\overview.txt', 'r', encoding='utf-8') as f: content = f.read() match = re.search(r'in this the first link is this\s*(\[\s*\{\s*"entity_id".*?\}\s*\])', content, re.DOTALL | re.IGNORECASE) if match: json_str = match.group(1) data = json.loads(json_str) with open('c:/Users/KIIT0001/shl_ass/catalog.json', 'w', encoding='utf-8') as out: json.dump(data, out, indent=2) print(f'Saved catalog.json with {len(data)} items.') else: print('Could not find JSON in logs.') except Exception as e: print(f'Error: {e}') traceback.print_exc()