Skip to content

Commit dc53626

Browse files
feat: Variable splitting supports JSON strings.
1 parent 6f64da4 commit dc53626

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

apps/application/flow/step_node/variable_splitting_node/impl/base_variable_splitting_node.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
@date:2025/10/13 15:02
77
@desc:
88
"""
9+
import json
910
from jsonpath_ng import parse
1011

1112
from application.flow.i_step_node import NodeResult
@@ -40,6 +41,12 @@ def save_context(self, details, workflow_manage):
4041
self.context['exception_message'] = details.get('err_message')
4142

4243
def execute(self, input_variable, variable_list, **kwargs) -> NodeResult:
44+
if type(input_variable).__name__ == "str":
45+
try:
46+
input_variable = json.loads(input_variable)
47+
except Exception:
48+
pass
49+
4350
self.context['request'] = input_variable
4451
response = {v['field']: smart_jsonpath_search(input_variable, v['expression']) for v in variable_list}
4552
return NodeResult({'result': response, **response}, {})

0 commit comments

Comments
 (0)