简体   繁体   中英

How to Split value in Jmeter from Response?

I am new to JMeter. I want to extract and Split response. Here is the response,

{
   "totalDocs":3,
   "recordBatchSize":10,
   "listingType":1,
   "currentPageNo":1,
   "recordStartFrom":0,
   "data":[
      {
         "fileType":"filetype/pdf.gif",
         "issueNo":1,
         "revisionId":"123456$$kWGFhP",
      },
      {
         "fileType":"filetype/pdf.gif",
         "issueNo":1,
         "revisionId":"222222$$kFMFhP",
      },
      {
         "fileType":"filetype/pdf.gif",
         "issueNo":1,
         "revisionId":"333333$$kYEGhP",
      }
   ],
   "viewType":"listing",
   "sortFieldType":"timestamp",
   "isIncludeSubFolder":true,
   "totalListData":0
}

I want to extract revisionId and split numbers ie 123456, 222222, 333333

Also please share where in JMeter I extract this value? Using Regular Expression Extractor Or JSR223 Post Processor, I am new to both.

I've tried with "revisionId"\s*:\s*"(\d+) (Which @Dmitri T suggested) but it passes variable name in the request ie ${ref_paramrevisionId1}. see attached image.

在此处输入图像描述

I think the easiest would be going for the Regular Expression Extractor, the following regular expression should extract the numbers you're looking for:

"revisionId"\s*:\s*"(\d+)

Explanation:

  • \s* - matches an arbitrary number of whitespaces
  • \d+ - matches an arbitrary number of digits

Demo:

在此处输入图像描述

More information:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM