Skip to content

Commit

Permalink
Fixed issue with json lists
Browse files Browse the repository at this point in the history
  • Loading branch information
eiglesias34 committed Jul 31, 2024
1 parent 54e9356 commit a72269f
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions rdfizer/rdfizer/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,19 +941,22 @@ def string_substitution_json(string, pattern, row, term, ignore, iterator):
if "[*]" in match:
if match.split("[*]")[0] in row:
child_list = row[match.split("[*]")[0]]
match = match.split(".")[1:]
object_list = []
for child in child_list:
if len(match) > 1:
value = child[match[0]]
for element in match:
if element in value:
value = value[element]
else:
if match[0] in child:
if "." in match:
match = match.split(".")[1:]
if len(match) > 1:
value = child[match[0]]
for element in match:
if element in value:
value = value[element]
else:
value = None
if match[0] in child:
value = child[match[0]]
else:
value = None
else:
value = child
if value is not None:
if (type(value).__name__) != "str":
if (type(value).__name__) != "float":
Expand Down Expand Up @@ -1039,19 +1042,22 @@ def string_substitution_json(string, pattern, row, term, ignore, iterator):
if match[:2] == "$.":
match = match[2:]
child_list = row[match.split("[*]")[0]]
match = match.split(".")[1:]
object_list = []
for child in child_list:
if len(match) > 1:
value = child[match[0]]
for element in match:
if element in value:
value = value[element]
else:
if match[0] in child:
if "." in match
match = match.split(".")[1:]
if len(match) > 1:
value = child[match[0]]
for element in match:
if element in value:
value = value[element]
else:
value = None
if match[0] in child:
value = child[match[0]]
else:
value = None
else:
value = child

if match is not None:
if (type(value).__name__) == "int":
Expand Down

0 comments on commit a72269f

Please sign in to comment.