Fix QueryJson on non-list nodes
This commit is contained in:
parent
4c675b8311
commit
dbe2a7b240
1 changed files with 8 additions and 5 deletions
|
@ -13,12 +13,15 @@ def queryFile(file_path, filter_path, filter_key=None, filter_val=None):
|
|||
if not data:
|
||||
return
|
||||
|
||||
for row in data:
|
||||
if filter_val: # Filter by value
|
||||
if row[filter_key] == filter_val:
|
||||
if type(data) == list:
|
||||
for row in data:
|
||||
if filter_val: # Filter by value
|
||||
if row[filter_key] == filter_val:
|
||||
back.append(row)
|
||||
else:
|
||||
back.append(row)
|
||||
else:
|
||||
back.append(row)
|
||||
else:
|
||||
back.append({"value": data})
|
||||
|
||||
return back
|
||||
|
||||
|
|
Loading…
Reference in a new issue