gtamkaleidoscope commited on
Commit
b82e84f
1 Parent(s): 8afce3b

Update app/util.py

Browse files
Files changed (1) hide show
  1. app/util.py +1 -12
app/util.py CHANGED
@@ -30,18 +30,7 @@ def compare_completion_and_prediction(completion, prediction, verbose=False):
30
 
31
  def json_to_dict(json_string):
32
  """function that takes string in the form of json and returns a dictionary"""
33
- json_string = json_string.replace('\n', '')
34
- json_string = json_string.replace('\t', '')
35
- json_string = json_string.replace(' ', '')
36
- json_string = json_string.replace('"', '')
37
- json_string = json_string.replace('{', '')
38
- json_string = json_string.replace('}', '')
39
- json_string = json_string.replace(':', ',')
40
- json_string = json_string.split(',')
41
- return {
42
- json_string[i]: json_string[i + 1]
43
- for i in range(0, len(json_string), 2)
44
- }
45
 
46
  def join_dicts(dict1, dict2):
47
  """function that joins two dictionaries into one dictionary
 
30
 
31
  def json_to_dict(json_string):
32
  """function that takes string in the form of json and returns a dictionary"""
33
+ return json.loads(json_string)
 
 
 
 
 
 
 
 
 
 
 
34
 
35
  def join_dicts(dict1, dict2):
36
  """function that joins two dictionaries into one dictionary