0
votes

I have a question that I just not find the full answer. I am using Jmeter 3.2, and using json in request, the problem is that I get encode response (%20france and not France). I read in net how to decode the response and move it to a file or a variable, But I do not want to do it, I want to decode the response and then to parse it using the json extractor, and take for example the ID field and put it in the next request. can someone please advise with step by step solutions regards

to be more specific 1. send a json request in jmeter 2. decode the response in jmeter 3. Take the ID field from decode response 4. put ID from step 3 in a new json request

2
And did you try anything or just waiting for code?user7294900

2 Answers

0
votes
  1. To send JSON just put it to "Body Data" tab of the HTTP Request sampler. You might also need to add a HTTP Header Manager to send Content-Type header with the value of application/json

    JMeter Send JSON

  2. To extract the values from JSON go for JSON Extractor, you can evaluate arbitrary JsonPath queries using it.
  3. To decode the whole response (or variables extracted in step 2) you can use __urldecode() function.

    URLDecode Function

See REST API Testing - How to Do it Right article for more information on using JMeter for load testing REST API endpoints, work with JSON responses, etc.

0
votes

Here is the procedure:

  1. Add your sampler or request in your thread group. Configure all the fields as your requirements. (i.e Server IP, port, method, Body data etc)

  2. Add an HTTP Header Manager to send the Content-Type header with the value of application/json

  3. Add a JSON Path Extractor under your sampler/request to extract the response. (Put any variable name where your extracted ID will be saved, give the correct expression in JSON Path expression to parse it, use NOT_FOUND as the default value).

Demo: enter image description here

  1. Now you can use that variable in your subsequent request.

Demo: enter image description here