Automation g1ant:未实现方法长度为()的jsonpath
我无法获取数组的大小项。g1ant中未实现jsonPath“length()”函数,因为引发异常“预期为数组索引”。 下面是g1ant脚本中用于测试的示例Automation g1ant:未实现方法长度为()的jsonpath,automation,robotics,rpa,g1ant,Automation,Robotics,Rpa,G1ant,我无法获取数组的大小项。g1ant中未实现jsonPath“length()”函数,因为引发异常“预期为数组索引”。 下面是g1ant脚本中用于测试的示例 addon core version 4.103.0.0 addon language version 4.104.0.0 ♥jsonImage = ⟦json⟧‴{ "book" : [ { "name" : "Bambi"} , { "name" : "Cinderella" } ] }‴ ♥aaa = ♥jsonImage⟦$.book
addon core version 4.103.0.0
addon language version 4.104.0.0
♥jsonImage = ⟦json⟧‴{ "book" : [ { "name" : "Bambi"} , { "name" : "Cinderella" } ] }‴
♥aaa = ♥jsonImage⟦$.book.length()⟧
dialog ♥aaa
还有其他与数组长度相关的解决方案吗?不可能以您尝试的方式获得json数组元素的数量。G1ANT正在使用Newtonsoft.Json库来选择Json标记,这些标记不允许像您可以读取的
.length()
这样的表达式
以下是您解决此问题的方法
♥jsonImage = ⟦json⟧‴{ "book" : [ { "name" : "Bambi"} , { "name" : "Cinderella" } ] }‴
♥jsonArrLength = 0
♥hasExceptionOccurred = false
while ⊂!♥hasExceptionOccurred⊃
try errorcall NoMoreElements
♥test = ♥jsonImage⟦book[♥jsonArrLength]⟧
♥jsonArrLength = ♥jsonArrLength + 1
end try
end while
dialog ♥jsonArrLength
procedure NoMoreElements
♥hasExceptionOccurred = true
end procedure
以您尝试的方式获取json数组元素的数量是不可能的。G1ANT正在使用Newtonsoft.Json库来选择Json标记,这些标记不允许像您可以读取的
.length()
这样的表达式
以下是您解决此问题的方法
♥jsonImage = ⟦json⟧‴{ "book" : [ { "name" : "Bambi"} , { "name" : "Cinderella" } ] }‴
♥jsonArrLength = 0
♥hasExceptionOccurred = false
while ⊂!♥hasExceptionOccurred⊃
try errorcall NoMoreElements
♥test = ♥jsonImage⟦book[♥jsonArrLength]⟧
♥jsonArrLength = ♥jsonArrLength + 1
end try
end while
dialog ♥jsonArrLength
procedure NoMoreElements
♥hasExceptionOccurred = true
end procedure