我的项目中有一些.js文件,这些文件是在WSO2 EI v6.4.0中开发的,我想在template.js
文件中的函数中使用jsonPath,但在控制台中收到错误消息jsonPath is not defined.
如何将jsonPath库导入WSO2 v6.4.0?
import groovy.json.*
,import groovy.json.JsonSlurper
,import com.jayway.jsonpath
库导入.js
文件中,但是没有用。function denemeJsonPath(){
var newPayload = {"store":{"book":[{"searchTerm":"AA","country":"BB","language":"CC"},{"searchTerm":"DD","country":"EE","language":"FF"},{"searchTerm":"GG","country":"HH","language":"ZZ"}]}};
var response = jsonPath(newPayload , "$..book[2]").toJSONString();
print ("responseeeeeeeeeeeeeeeeeeeeeeeeeee:"+response);
}
它在控制台上显示以下错误:
org.mozilla.javascript.EcmaError: ReferenceError: "jsonPath" is not defined.
我希望在WSO2 v6.4.0的序列和模板文件中使用jsonPath函数