
How the BlazeMeter Load Testing Cloud Complements and Strengthens JMeter Are you an experienced JMeter user and want to know more?Ĭheck out BlazeMeter University. If you still experience problems, have questions or want to share any form of feedback - just use the discussion form below. That pretty much covers the JSON Path Extractor, you should be good to go now. They come in the array form (working with arrays has been covered above). locationĪs you can see, the JSON Path Extractor captures both elements by a single query. Reference name: anything meaningful, i.e. Configure the JSON Path Extractor as follows: So let’s get both the “state” and “city” element values with a single query. In order to get multiple values, use the union operator. It is also possible to extract several values in one shot, in case you need to reduce the JSON Path Extractors count. Selecting Multiple Values with One Expression The final version would = 'Smith')].firstName You should remember that the array members indices are zero-based, so append. In order to get rid of the square brackets and quotation marks, instruct JMeter to take the first array member only.

This is the possibility that I mentioned earlier. firstName to the = 'Smith')].firstNameĪs you can see, we’re getting. Ok, we filtered out the “not interesting” employees, now let’s get the first name of Mrs. Given that we need to get an element where the “lastName” attribute equals “Smith”, the expression would = 'Smith')]Īlternatively, for better readability you can substitute a wildcard with a parent element name = 'Smith')] We’ll need the following JSON Path syntax elements: get “firstName” where “lastName” is “Smith” - it is also possible using JSON Path filter expressions. If you need to get a value from a JSON response which depends on the other value, i.e. Remember that with this tip, in some cases where there is only one member in the response array, you will get it in square brackets like, providing a zero index that will remove the array identifiers and you’ll have only an “interesting” string value. Use the $ reference to get “John”Ĭhange your JSON Path Expression to include a zero-based index of the result array member: $.firstName. If you use the following JSON Path Extractor configuration: For instance, you need to get a “John” name from the response.

View Results Tree - visualizes the Dummy and Debug samplers output The following JSON structure will be used for all the demonstrations, in case of you would like to replicate one of the examples:Īdditionally, the following Test Elements might be useful:ĭummy Sampler - useful for debugging, you can put any data into “Response Data” field and make the JSON Path Extractor a child of the Dummy Sampler, and it will allow you to avoid sending extra requests to the serverĭebug Sampler - outputs JMeter Variable values (it also can print the JMeter and System properties) This post covers a bit more advanced scenarios, such as working with arrays, conditional select and a selection of multiple values by a single JSON Path query. The installation process, basic use cases and syntax have already been covered on our blog in the Using the XPath Extractor in JMeter guide (scroll down to “Parsing JSON” section). It is a handy tool to execute JSON Path expressions against JSON responses and storing the result into a JMeter Variable. a correlation) - is also vital.įor these reasons, the JSON Path Extractor plugin was created. Furthermore, the ability to “read” JSON responses - to be able to check whether the response matches expectations or to extract an important, dynamic part of the response for later reuse (i.e. What does this mean to JMeter users trying to run tests on their website/application that uses JSON?įirst, it will require some extra configuration to be able to correctly send the JSON data (use the HTTP Header Manager to send a “Content-Type” header with the value of “application/json”). The most commonly used data format is JSON (JavaScript Object Notation) - a JavaScript-derived language which consists of name/value pairs that is easily human readable. How the BlazeMeter Load Testing Cloud Complements and Strengthens JMeterĪn ever increasing number of websites and applications are being built on top of Representational State Transfer (aka RESTful) architecture which simplifies the interchange of client and server data.Selecting Multiple Values with One Expression.

It details scenarios involving working with arrays, conditional select and a selection of multiple values by a single JSON Path query. This post will expand on our earlier coverage on this blog of the JSON Path Extractor, a JMeter plugin that enables extracting values from JSON responses.
