1) In my response body comes like json format.
2) Some expected reason ,i have changed that body json to normal text using below code and working expected way
import groovy.json.*
String js = vars.get("cAccountDetails")
def data = new JsonSlurper().parseText(js)
log.info("the value is "+ data)
vars.putObject('data', data)
3) This code meaning converted json to normal text and stored in some variable thats "data"
4) so my response stored in "data" variable .
5) From "data", how can i extract**specific data**using groovy code or some other code?
import java.util.regex.*
import java.util.regex.Matcher
import java.util.regex.Pattern
def matches = (data =~ '{accountDetails=\\[(.*)\\],')
vars.putObject('matches', matches)
上述代码用于关联{“匹配”变量将存储提取的值}
1.但是上面的代码不工作,我怎么能解决这个问题?
Thanks in advance!!
1条答案
按热度按时间xkrw2x1b1#
我们无法帮助您,除非您共享您的
cAccountDetails
变量值,并指出您需要从中提取什么。第一眼看起来,正则表达式应该有点不同,即。
更多信息: