Sep-27-2022, 06:34 PM
This is untested, but should allow you to load and display contents
import json from pathlib import Path import os #set path to same as script os.chdir(os.path.abspath(os.path.dirname(__file__))) homepath = home = Path('.') def display_dict(dictname, level=0): indent = " " * (4 * level) for key, value in dictname.items(): if isinstance(value, dict): print(f'\n{indent}{key}') level += 1 display_dict(value, level) else: print(f'{indent}{key}: {value}') if level > 0: level -= 1 def main(): jsonfile = homepath / 'response_1664244998587.json' print(jsonfile.resolve()) with jsonfile.open() as fp: jsondata = json.load(fp) display_dict(jsondata) main()