Home > Software design >  API Jmeter request modification upon using JSR223 PreProcessor
API Jmeter request modification upon using JSR223 PreProcessor

Time:08-24

Hello could someone help me how to remove the additional "{ and "} on the request upon using JSR223 PreProcessor, This is the syntax I use to generate the request below. Your response is highly appreciated. Thank you so much.

Screenshot:

enter image description here

Expected Result:

    "metrics": {

            "com.cixsoft.agent.metric.NetworkMetric": "NetworkMetric.json",
            "com.cixsoft.agent.metric.ProcessInfoMetric": "ProcessInfoMetric.json",
            "com.cixsoft.agent.metric.CpuMetric": "CpuMetric.json"
    },

Actual Result:

    "metrics": {
        "{ -<< Remove this open curly braces
            "com.cixsoft.agent.metric.NetworkMetric": "NetworkMetric.json",
            "com.cixsoft.agent.metric.ProcessInfoMetric": "ProcessInfoMetric.json",
            "com.cixsoft.agent.metric.CpuMetric": "CpuMetric.json"
      "} -<< -<< Remove this close curly braces
    },

CodePudding user response:

  1. Don't post code as image
  2. Give us a minimal reproducible example
  3. Follow other recommendations from How do I ask a good question? article

For example we need to know:

  1. The value of the agentSimUserMetric variable
  2. How exactly you're using this userMetric variable

Looking at my crystal ball I see that you have something like:

"metrics" : {
    ${userMetric}
}

while you need to have just

"metrics" : ${userMetric}

so I'm 99.9% sure that it's you who is adding these curly braces and asking us for a piece of advice regarding how to remove them sounds kind of weird.

More information:

  • Related