jMeter学习笔记-json提取器

{
	"code": 0,
	"message": "获取数据成功",
	"data": {
		"percent": "10%",
		"rank": "4",
		"amount": "2000.00",
		"rankList": [
			{
				"code": "c01",
				"name": "马云",
				"rank":1,
				"amount": "20520"
			},
			{
				"code": "c12",
				"name": "马小龙",
				"rank": 2,
				"amount": "21000"
			},
			{
				"code": "c13",
				"name": "马花疼",
				"rank": 3,
				"amount": "5100"
			}
		]
	}
}

参考:https://github.com/json-path/JsonPath

提取数组里的某一个对象

提取:马小龙

$.data.rankList[?(@.code=="c12")].name

获取前N个值

$.data.rankList[:2].name

获取固定条件下的多个key的value值

$.data.rankList[?(@.rank<=2)].["name","amount"]

posted @ 2020-06-19 09:08  软件技术开发  阅读(178)  评论(0编辑  收藏  举报