From 5dbf3e2eca7fca1505c1af45ea6884b5597db8f2 Mon Sep 17 00:00:00 2001
From: Brandon Rodriguez <brodriguez8774@gmail.com>
Date: Sun, 24 Nov 2019 20:00:09 -0500
Subject: [PATCH] Update json readin to ignore capitalization of keys

---
 resources/simplex/simplex.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/resources/simplex/simplex.py b/resources/simplex/simplex.py
index d5965e0..82e9ea8 100644
--- a/resources/simplex/simplex.py
+++ b/resources/simplex/simplex.py
@@ -81,6 +81,16 @@ class Simplex():
         Attempts to parse passes JSON data into simplex format.
         :param json_data: JSON data to attempt to parse.
         """
+        # Check that param is of dict type.
+        if not isinstance(json_data, dict):
+            raise TypeError('Expected "json_data" param to be of dict type.')
+
+        # Set all key names to be lowercase.
+        new_dict = {}
+        for key, value in json_data.items():
+            new_dict[str(key).lower()] = value
+        json_data = new_dict
+
         # Check that "constraint" key exists.
         if 'constraints' in json_data:
             matrix_a = json_data['constraints']
@@ -124,8 +134,6 @@ class Simplex():
         # Check if "description" key exists.
         if 'description' in json_data:
             description = json_data['description']
-        elif 'Description' in json_data:
-            description = json_data['Description']
         else:
             description = None
 
-- 
GitLab