Book Image

Performance Testing with JMeter

By : Bayo Erinle
Book Image

Performance Testing with JMeter

By: Bayo Erinle

Overview of this book

Table of Contents (14 chapters)

The JSON Path Extractor element


Another helpful nugget in the JMeter plugin's project is the JSON Path Extractor element. This makes working with JSON pure bliss. It helps extract data out of a JSON response using JSONPath syntax (http://goessner.net/articles/JsonPath/index.html#e2). For complex JSON structures, using JMeter's bundled XPath Extractor can sometimes lead to heartache when trying to get at targeted elements. Where XPath Extractor fails, JSON Path Extractor shines.

Consider a JSON structure like the following:

{ "store": {
    "book": [ 
{ "category": "reference",
        "author": "Nigel Rees",
        "title": "Sayings of the Century",
        "price": 8.95
      },
{ "category": "fiction",
        "author": "Evelyn Waugh",
        "title": "Sword of Honour",
        "price": 12.99
      },
{ "category": "fiction",
        "author": "Herman Melville",
        "title": "Moby Dick",
        "isbn": "0-553-21311-3",
        "price": 8.99
      },
{ "category": "fiction",
     ...