[API请求正文[我是jmeter的新手。我有一个HTTP请求可以提取数据,响应如下:
[ “ {\” senderId \“:\” 3 \“,\” receiverId \“:\” 90 \“,\” type \“:\” 1 \“,\” objectId \“:\” 1 \“, \“ notificationDetails \”:null}“, “ {\” senderId \“:\” 3 \“,\” receiverId \“:\” 90 \“,\” type \“:\” 3 \“,\” objectId \“:\” 1 \“, \“ notificationDetails \”:null}“, “ {\” senderId \“:\” 3 \“,\” receiverId \“:\” 90 \“,\” type \“:\” 2 \“,\” objectId \“:\” 1 \“, \“ notificationDetails \”:null}“, “ {\” senderId \“:\” 3 \“,\” receiverId \“:\” 90 \“,\” type \“:\” 0 \“,\” objectId \“:\” 1 \“, \“ notificationDetails \”:null}“ ]
我想将此json作为数组传递给Next Http请求 我的要求如下:
/ move / seen /?notifications [] =“ {\” senderId \“:\” 3 \“,\” receiverId \“:\” 90 \“,\” type \“:\” 1 \“ ,\“ objectId \”:\“ 1 \”,\“ notificationDetails \”:null}“, “ {\” senderId \“:\” 3 \“,\” receiverId \“:\” 90 \“,\” type \“:\” 3 \“,\” objectId \“:\” 1 \“, \“ notificationDetails \”:null}“, “ {\” senderId \“:\” 3 \“,\” receiverId \“:\” 90 \“,\” type \“:\” 2 \“,\” objectId \“:\” 1 \“, \“ notificationDetails \”:null}“, “ {\” senderId \“:\” 3 \“,\” receiverId \“:\” 90 \“,\” type \“:\” 0 \“,\” objectId \“:\” 1 \“, \“ notificationDetails \”:null}“&userId = 90
有人可以指导我如何在jmeter中做到这一点。
答案 0 :(得分:0)
考虑到这是完整响应,如果您真的想获取完整响应,请使用JSR223后处理器,如下所示:-
使用$ {response}获取它
但是情况并非如此,应该避免。因此,要获取特定数据,请使用后处理器:-
JSON的JSON提取器
用于HTML提取的CSS / JQuery提取器
用于XML的XPath提取器
任何文本的正则表达式提取器
有关JSON的更多信息,请参见下面的链接: https://www.ubik-ingenierie.com/blog/easy-scripting-of-json-applications-with-apache-jmeter/
希望这会有所帮助。