Jmeter:使用特定的 JSON 值从响应中提取 JSON 块

Jmeter: Extract JSON block from response using particular JSON value

我正在尝试从 HTTP 响应中提取 JSON 块,并且根据条件,我想提取特定的 JSON 块。 例如:

{
    "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
}

根据上面的 JSON 回复,我想要一本价格低于 10 的特定书籍,即

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

我正在尝试在 JMeter 5.0 中使用 JSON 提取器。

请帮忙。

谢谢, 席德

你试过这个例子吗:

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

来自 JSONPath documenation?

这似乎正是您要查找的内容:


另据通知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)尽快