Jmeter使用:JSON返回数据处理

想要解决的问题:

通过查询接口,获取response数据,作为下个请求post的参数值

 后置处理器:JSON Extractor

先下载一个插件:JSONPathExtractor

Names of created variables: 名称 
JSON Path expressions:JSON表达式 
Match No.(0 for Random):匹配哪个,可为空即默认第一个 
Default Values:未取到值的时候默认值

举例response返回数据:

{
    "code": 2000,
    "message": "success",
    "body": {
        "identifier": "JKCS5449-4",
        "useScopeStr": "全部",
        "executeTypeStr": "按周执行",
        "timeDTOList": [
            {
                "executeTime": "08:00",     
                "weekStr": "星期六"
            }
        ]
    }
}

JSON Path expressions 中:

1. 取值identifier,可用$.body.identifier

2. 取值weekStr(数组),可用$.body.timeDTOList[0].weekStr

posted on 2018-03-28 11:20  rechin  阅读(4665)  评论(0编辑  收藏  举报

导航