Jmeter JSON响应转换为带有请求修改的数组 [英] Jmeter JSON response converting to an Array with request modification
本文介绍了Jmeter JSON响应转换为带有请求修改的数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,我想模拟这个场景,例如,如果我在下面得到这个响应,我想在我的后续请求中使用它.appid 将用于 key 和 Role 到 value 参数.非常感谢您的回复.非常感谢.
请求:
<代码>[{appid":4a157c66-4965-30b2-af47-7dc68651c350",orgId":205d64ff-9b58-3aad-bf48-29ec41dd4ef0",ipAddress":192.168.100.235",角色":广告服务器"},{appid":ba3fe4b4-1307-38e4-ace4-1636f8ffef3e",orgId":205d64ff-9b58-3aad-bf48-29ec41dd4ef0",ipAddress":192.168.100.236",角色":测试服务器"}, {appid":29b59fbb-ea93-3adf-ba9a-fd353abaac21",orgId":205d64ff-9b58-3aad-bf48-29ec41dd4ef0",ipAddress":192.168.100.237",角色":UAT SERVER"}]
响应截图:
预期结果:
解决方案
你可以使用
以下演示在查看结果树中测试 JSON JMESPath Query
.
Hello I want to simulate this scenario , example if I got this response below, I want to use that on my succeeding request. The appid will be use for key and Role to value parameter. Your response is highly appreciated. Thank you so much.
Request:
[{
"appid": "4a157c66-4965-30b2-af47-7dc68651c350",
"orgId": "205d64ff-9b58-3aad-bf48-29ec41dd4ef0",
"ipAddress": "192.168.100.235",
"Role" : "AD SERVER"},
{
"appid": "ba3fe4b4-1307-38e4-ace4-1636f8ffef3e",
"orgId": "205d64ff-9b58-3aad-bf48-29ec41dd4ef0",
"ipAddress": "192.168.100.236",
"Role" : "TESTING SERVER"
}, {
"appid": "29b59fbb-ea93-3adf-ba9a-fd353abaac21",
"orgId": "205d64ff-9b58-3aad-bf48-29ec41dd4ef0",
"ipAddress": "192.168.100.237",
"Role": "UAT SERVER"
}]
Response Screenshot:
Expected Result:
解决方案
You could use JSON JMSEPath extractor to extract values and transform the keys. JMESPath Tutorial
[].{Key:Role,Value:orgId}
Following demonstrate the testing the JSON JMESPath Query
in the View Results Tree.
这篇关于Jmeter JSON响应转换为带有请求修改的数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文