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 06:14:07 +00:00 committed by GitHub
parent ea0ebc020c
commit 83b6abf4ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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]