【问题标题】:Jmeter Key Extraction value in the response响应中的 Jmeter Key Extraction 值
【发布时间】:2021-12-27 07:30:44
【问题描述】:

我想提取响应生成的键值,有没有办法使用 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 api jmeter response jsonpath


    【解决方案1】:

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

    keys(data)
    

    演示:

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

    【讨论】:

    • 感谢 Dmitri 您提供的语法可以正常工作,如果我想在响应中提取创建的键怎么办?我可以知道什么是正确的语法吗?再次感谢您。
    猜你喜欢
    • 2015-06-06
    • 1970-01-01
    • 2023-03-18
    • 1970-01-01
    • 2021-07-03
    • 1970-01-01
    • 1970-01-01
    • 2021-06-03
    • 1970-01-01
    相关资源
    最近更新 更多