Skip to content

Commit 135100a

Browse files
committed
Fix formatting of lists in ObjectJSON
1 parent 04854ce commit 135100a

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

braspag_sdk/utils/object_json.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,22 @@ def __getattribute__(self, attribute):
2424

2525

2626
def process_name_key(dictionary):
27+
28+
# If it's a list, process each item.
29+
if isinstance(dictionary, list):
30+
new_list = []
31+
for item in dictionary:
32+
new_list.append(process_name_key(item))
33+
return new_list
34+
35+
# If it's not a dictionary (and not list), just return it as is.
2736
if not isinstance(dictionary, dict):
2837
return dictionary
2938

39+
# If it's a dictionary, process each key/value.
3040
new_dictionary = {}
31-
3241
for key in dictionary:
3342
new_dictionary[capitalize_key(key)] = process_name_key(dictionary[key])
34-
3543
return new_dictionary
3644

3745

0 commit comments

Comments
 (0)