需要从Jmeter中的此JSON中提取数据 [英] Need to extract data from this JSON in Jmeter

查看:576
本文介绍了需要从Jmeter中的此JSON中提取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须从Jmeter中的JSON数组中提取所有唯一标识",然后将这些值存储在数组中,以便以后我可以将其与每个控制器一起使用,以附加到另一个URL的尾部.

I have to extract all the "uniqueid" from this JSON array in Jmeter and then store these values in an array so that later I can use it with for each controller to append to the tail of another URL.

有人可以帮我在Jmeter中做到这一点吗?

Can anyone help me how to do this in Jmeter.

您的帮助将不胜感激.谢谢!

Your help would be appreciated. Thanks!

{"groups":[
{
  "categoryid": 4003,
  "name": "Agarbatti",
  "properties": [
    {
      "name": "Take Photo",
      "type": "image",
      "displaytype": "image",
      "mandatory": false,
      "uniqueid": "1149"
    }
  ]
},
{
  "categoryid": 4005,
  "name": "Cigarettes",
  "properties": [
    {
      "name": "Take Photo",
      "type": "image",
      "displaytype": "image",
      "mandatory": false,
      "uniqueid": "1150"
    }
  ]
},
{
  "categoryid": "1001",
  "name": "Remark",
  "properties": [
    {
      "name": "Remark",
      "type": "string",
      "displaytype": "edit",
      "uniqueid": "Remarks",
      "mandatory": "true"
    }
  ]
    }
  ]
  }

推荐答案

最好使用 JSONPath Extractor 可通过 JMeter插件使用(您需要带Libs Set的Extras).

It's better to use JSONPath Extractor available via JMeter Plugins (you'll need Extras with Libs Set).

因此,对您的数据遵循JSONPath表达式:

So on your data following JSONPath Expression:

$..uniqueid

将返回下一个结构:

["1149","1150","Remarks"]

请参见在JMeter中使用XPath提取器指南(向下滚动至有关更多详细信息和JSONPath食谱的信息,请参阅解析JSON").

See Using the XPath Extractor in JMeter guide (scroll down to "Parsing JSON") for more details and a kind of JSONPath cookbook.

这篇关于需要从Jmeter中的此JSON中提取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆