0

I'm trying to extract the JSON block from the HTTP response and depending on the condition, I want to extract a particular block of JSON. For eg.:

{
    "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
            }
        ],
        "bicycle": {
            "color": "red",
            "price": 19.95
        }
    },
    "expensive": 10
}

From the above JSON response, I want a block of a particular book where, price is less than 10 i.e.

{
     "category": "reference",
     "author": "Nigel Rees",
     "title": "Sayings of the Century",
     "price": 8.95
}

I'm trying to use JSON Extractor in JMeter 5.0.

Please help.

Thanks, Sid

1 Answer 1

2

Have you tried this example:

$.store.book[?(@.price < 10)]

from the JSONPath documenation?

It appears to be exactly what you're looking for:

enter image description here


Also be informed that according to 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure you should always be using the latest version of JMeter so I would recommend upgrading to JMeter 5.2.1 (or latest stable JMeter version) as soon as possible

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.