|
|
@@ -20,7 +20,7 @@ public class MyJsonFilter implements TemplateMethodModelEx {
|
|
|
throw new TemplateModelException("参数个数错误");
|
|
|
}
|
|
|
//第一个参数为json字符串
|
|
|
- String content = arguments.get(0).toString();
|
|
|
+ Object value = arguments.get(0);
|
|
|
//第二个参数为json路径
|
|
|
String path = arguments.get(1).toString();
|
|
|
//第三个参数为方法
|
|
|
@@ -31,9 +31,8 @@ public class MyJsonFilter implements TemplateMethodModelEx {
|
|
|
String resultType = arguments.get(4).toString();
|
|
|
|
|
|
//根据json路径获取值
|
|
|
- Object value = content;
|
|
|
if (StrUtil.isNotBlank(path)) {
|
|
|
- value = JSONUtil.parseObj(content).getByPath(path);
|
|
|
+ value = JSONUtil.parseObj(String.valueOf(value)).getByPath(path);
|
|
|
}
|
|
|
if ("obj".equals(resultType)) {
|
|
|
return value;
|