randomising length of json array in request body

Hi All,

Hope you all are doing good.

We have a requirement were we need to alter the length of an array (part of request body). e.g
Request:

{
  "data": [
    {
      "userId": 1,
      "id": 1,
      "title": "sunt aut",
      "body": "quia "
    },
    {
      "userId": 1,
      "id": 1,
      "title": "sunt aut",
      "body": "quia "
    },
    {
      "userId": 1,
      "id": 1,
      "title": "sunt aut",
      "body": "quia "
    }
  ]
}

the length of the data array needs to be changed for different requests in loads. Any best way to do this in gatling? if so can you please share how we could do it. I see for complex request pebble templating is an option but I don’t find any examples.

Thanks and Regards,
Srini