sp-hydra-veil-gui/SMS-Exchange-Linux-GUI/process_api_data/convert_to_dictonary.py
2026-01-28 13:13:57 +01:00

13 lines
430 B
Python
Executable file

import json
def search_by_category(category, data):
# Initialize an empty list to hold matching items
matching_items = []
for entry in data:
# Check if the category matches
if category in entry.values():
matching_items.append(entry)
# Convert dictonary of results into a list:
list_of_matching_items = [list(d.keys())[0] for d in matching_items]
return list_of_matching_items