响应中的 Jmeter Key 提取值

Jmeter Key Extraction value in the response

我想提取从响应生成的键值,有没有办法使用 JSON 路径提取器进行模拟?

响应示例:

{
    "data": {
        "1637042070532561": {
            "symbol": "BAUa",
            "side": "buy",
            "quantity": "1",
            "limitPrice": "2145",
            "instrumentId": 4,
            "created": "1637042070533",
            "orderStatus": "rejected",
            "type": "limit",
            "executions": {
            },
            "decimals": 2,
            "commission": "0",
            "currency": "EUR",
            "averagePrice": "0",
            "id": "1637042070532561",
            "filledStatus": "unfilled",
            "filledPercent": "0.00",
            "filledQty": "0"
        }
    },
    "action": "set-orders",
    "type": "orders",
    "status": "OK",
    "timestamp": "2021-11-16T05:54:30.536Z"
}

预期结果:1637042070532561

选择 JSON JMESPath Extractor, it provides keys function 允许查询 JSON 属性名称,在您的情况下,查询类似于:

keys(data)

演示:

更多信息:The JMeter JSON JMESPath Extractor and Assertion: A Guide