title: Jmeter generate json payload of request dynamically
body: <p>I have a Jmeter test plan where I want my HttpSampler to send a post request.</p>
  
  <p>The body of the request should contain Json as follows:</p>
  
  <pre><code>{
    "productIds" : [
      "p1",
      "p2",
      ...
    ]
  }
  </code></pre>
  
  <p>I have setup a random variable generator that returns well-formed productId with every call. What I would like to do is generating the payload by filling productIds of random pid's taken from the generator, directly in the body of the request. Something like (suppose *** is the scripting escape):</p>
  
  <pre><code>{
    "productIds" : [
       ***
         for i in (1, $productsCount) {
           write("\"$randomPid\"\n")
         }
       ***
    ]
  }
  </code></pre>
  
  <p>Is it possible? If yes, how? If not, how would you approach the issue?</p>
  
  <p>Thanks!</p>