restjmeterjmxassertion

API Jmeter request modification upon using JSR223 PreProcessor


How can I remove the additional "{ and "} on the request upon using JSR223 PreProcessor?

This is the syntax I use to generate the request below.
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
},

Solution

  • 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: