Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to extract complete JSON response data in JMeter?

Tags:

json

jmeter

I am new to JMeter and still in learning phase.

I am making a rest call in JMeter. The response data that i receive, i want to use it as it is in following rest call. Sample of response data that i receive is:

{  
   "token":"ab062ad1-0585-4b41-b491-1bd4f6de57da",
   "refreshToken":"5444b837-7f18-4570-a84b-80dac80b393c",
   "expiresBy":"Sat May 02 14:49:06 EDT 2015",
   "mcomroles":[  
      "Super BA Admin",
      "WorkgroupSuperBAUser"
   ],
   "bcomroles":[  
      "Super BA Admin",
      "WorkgroupSuperBAUser"
   ]
}

For this i added a Regular Expression Extractor but i do not know what regular expression to give.

Please suggest. Thanks.

like image 988
silver_noodles Avatar asked Apr 06 '15 23:04

silver_noodles


People also ask

What is JSON extract?

JSON_EXTRACT. Extracts a JSON value, such as an array or object, or a JSON scalar value, such as a string, number, or boolean. JSON-formatted STRING or JSON. JSON_EXTRACT_SCALAR. Extracts a scalar value.


1 Answers

If you want to use response as it is , add a beanshell-post processor instead of Regular Expression Extractor.

vars.put("JSONResponse", prev.getResponseDataAsString());

Now you access it using below statement in the next request.

${JSONResponse}
like image 89
vins Avatar answered Sep 22 '22 18:09

vins