Forum Discussion

Scripter's avatar
Scripter
Occasional Contributor
7 years ago

parsing json via Groovy in soapui

The JSON Data is a response of a rest service(list_files) {"Files": [ {"filepath": "input/file_29112017d.csv"}, {"filepath": "input/file_29112017d.log"}, {"filepath": "input/file_29112017d....
  • HKosova's avatar
    7 years ago

    Hi Scripter,

     

    SoapUI 5.3.0 uses an older version of the JSONPath library (v0.9.1) which does not seem to support the regex match operator (=~).

     

    Try JsonSlurper instead:

    import groovy.json.JsonSlurper
    ...

    def json = new JsonSlurper().parseText(response) def csvpath = json.Files.find { it.filepath.endsWith(".csv") }.filepath log.info csvpath