I'm struggling to get this list from a json file to call correctly, and I was hoping for help. I'm still really new to learning python. I always end up with "TypeError: list indices must be integers or slices, not str"
CONFIG_ITEMS = 'items.json' with open(CONFIG_ITEMS) as json_data_file: config_items = json.load(json_data_file)
def get_value(items:str): items = items.replace(" ", "").lower() aliases = config_items['aliases'] if items in aliases: return [value[aliases]] else: return NoneThe json looks like this:
[ { "aliases": ["carvedtwine","carved","carvedt","ct"], "value": 10 } ]