tstone87 commited on
Commit
87c42f0
·
verified ·
1 Parent(s): babe37e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -13,9 +13,9 @@ def load_json_data():
13
  with open(DATA_FILE, "r", encoding="utf-8") as f:
14
  data = json.load(f)
15
 
16
- # Ensure data is a dictionary, not a list
17
  if isinstance(data, list):
18
- raise ValueError("Expected a dictionary but found a list. Please update your JSON file format.")
19
 
20
  return data
21
  except (FileNotFoundError, ValueError) as e:
 
13
  with open(DATA_FILE, "r", encoding="utf-8") as f:
14
  data = json.load(f)
15
 
16
+ # Convert list to dictionary if needed
17
  if isinstance(data, list):
18
+ data = {list(entry.keys())[0]: list(entry.values())[0] for entry in data if isinstance(entry, dict)}
19
 
20
  return data
21
  except (FileNotFoundError, ValueError) as e: