Pass keys with arrays of data using SharedArray

Hi Team,

I need to test one endpoint which expects body as below, i.e. tokens array
{"tokens": [{"chainId": "0x1","address": "0x000000007a58f5f58e697e51ab0357bc9e260a04"}]}

If I want to run test by passing multiple values in tokens array, like below

{
    "tokens": [
      {
        "chainId": "0x1",
        "address": "0x000000007a58f5f58e697e51ab0357bc9e260a04"
      },
      {
        "chainId": "0x171",
        "address": "0x0000000000085d4780b73119b644ae5ecd22b376"
      }
    ]
  }

How can I achieve using SharedArray ?

If I use the complete JSON directly in test script, it’s working

But I store test data in separate file e.g. tokens.json & call in test script
if I use SharedArray like below, it’s giving 400:"BadRequestException
Because its passing body without tokens array like below i.e.

[{"chainId":"0x1","address":"0x000000007a58f5f58e697e51ab0357bc9e260a04"}]

instead it should pass body as
{"tokens": [{"chainId": "0x1","address": "0x000000007a58f5f58e697e51ab0357bc9e260a04"}]}

Test Script

const data = new SharedArray("tokens", function () {
   tokens = JSON.parse(open("./tokens.json")).tokens;
  return tokens;
});

export default function () {
  const requestUrl = "endpoint";

  const result = http.post(requestUrl, JSON.stringify(data), params, {
    tags: { name: "Category Tokens" },
  });

Body:

{
    "tokens": [
      {
        "chainId": "0x1",
        "address": "0x000000007a58f5f58e697e51ab0357bc9e260a04"
      },
      {
        "chainId": "0x171",
        "address": "0x0000000000085d4780b73119b644ae5ecd22b376"
      }
    ]
  }

Thank You