1
votes

i'am using jmeter "Regular Expression Extractor",my response looks as below

[{"@class":"com.test.dto.BoardDTO",
      "ReadOnly":false,
      "author":"John",
      "id":"89BC331D723F",
      "isPublic":false
   },
{"@class":"com.test.dto.BoardDTO",
      "ReadOnly":false,
      "author":"Alex",
      "id":"FTH7JBDRF567",
      "Public":false
   }]

I need to extract all IDs of class:"com.test.dto.BoardDTO" in this case "89BC331D723F" and "FTH7JBDRF567"

Any proposition please !

1

1 Answers

1
votes

You should use JSON Extractor instead of regular expression extractor

Add a JSON Extractor and fill in the fields as below

  • JSON path expression: $.[*][?(@.@class == "com.test.dto.BoardDTO")].id
  • Match Numbers: -1

This will return all IDs where @class value was com.test.dto.BoardDTO. You can validate it using View Results Tree & Debug Sampler combination.