JMeter json提取器, 语法汇总

图例


数据样式

{"code":200,"msg":"操作成功","data":{"currentPage":1,"size":10,"total":6,"data":[{"todoId":"1582995641035132930","todoType":"2","content":"test交了入会申请","status":"0","createdTime":"2022-10-20 15:22:36"},{"todoId":"1582993656630218753","todoType":"0","content":"企业2交了入会申请","status":"0","createdTime":"2022-10-20 15:15:16"},{"todoId":"1582713808942796801","todoType":"3","content":"企业3交了入会申请","status":"0","createdTime":"2022-10-19 20:42:32"},{"todoId":"1582712963949924353","todoType":"3","content":"企业4","status":"0","createdTime":"2022-10-19 20:39:10"},{"todoId":"1582712941581701122","todoType":"3","content":"企业5交了入会申请","status":"0","createdTime":"2022-10-19 20:39:05"},{"todoId":"1582549321484865537","todoType":"3","content":"企业5交了入会申请","status":"0","createdTime":"2022-10-19 09:48:55"}]}}

1.todoId

    绝对路径 :    $.data.data[*].todoId

    相对路径:   $..todoId

2.第N个todoId(与python切片相似,从0开始算)

    绝对路径: $.data.data[*].todoId[N]

    相对路径:     $..todoId[N]

3.todoType字段值为 3  的数据  (值为数字建议使用这个)

    相对路径: $..[?(@.todoType=="3")]

    status字段值为0 的    $..[?(@.status)]

4.todoType字段  值为 3  的 todoId (值为数字建议使用)

    相对路径: $..[?(@.todoType=="3")].todoId

5. createdTime字段 时间大于2022-10-19的记录的 的 todoId    

   相对路径:$.data.data[?(@.createdTime>'2022-10-19')].todoId 

6.content字段  中包含test的记录   (取值为非数字是,使用包含)

    相对路径:$..[?(@.content=~/.*test.*?/i)]

你可能感兴趣的:(JMeter json提取器, 语法汇总)