0
{  
  "response":{  
    "statusCode":"00",
    "status":"success",
            "responseData":
             [
                   {  
                     "status":1,
                     "themeID":27,
                     "themeName":"ThemeName25",
                     "templateId":22
                    }
             },
                  {  
                     "status":1,
                     "themeID":28,
                     "themeName":"ThemeName28",
                     "templateId":28
                  }
             }
             ]
}

Here need to extract the json values from first and second array But without the use of jmeter plugins like JSON PATH EXTRACTOR. Can anyone suggest the idea for this?

tsr_qa
  • 633
  • 3
  • 9
  • 27
  • Possible duplicate of [Jmeter extracting fields/parsing JSON response](http://stackoverflow.com/questions/18562060/jmeter-extracting-fields-parsing-json-response) – timbre timbre Apr 28 '16 at 20:21

1 Answers1

2

Regular Expression Extractor is usually much faster compared to other extractors like XPath, JSON etc - Check this site for the comparison.

Lets assume we are trying to get the value of all the theme ids from the JSON. Add a Regular Expression Extractor and update the details as shown here.

enter image description here

  1. You need a reference name to store the value found
  2. The pattern to check
  3. Template used to create a string from the matches found
  4. -1 for all matches, 0 for random, 1 for first ..etc

enter image description here

  1. <variable>_matchNr will give the total matches
  2. theme.id_1 will return the first match which is 27
  3. theme.id_2 will return the second match which is 28

More details and examples are here.

vins
  • 15,030
  • 3
  • 36
  • 47