Update parse.py to handle empty list result (#10915)

Co-authored-by: crazywoola <427733928@qq.com>
This commit is contained in:
Pedro Gomes
2024-11-21 14:14:07 +08:00
committed by GitHub
co-authored by crazywoola
parent ea0ebc020c
commit 83b6abf4ad
@@ -40,6 +40,9 @@ class JSONParseTool(BuiltinTool):
expr = parse(json_filter)
result = [match.value for match in expr.find(input_data)]
if not result:
return ""
if len(result) == 1:
result = result[0]