Json with Data and Error

hi
I want to genarate response like this

{
  "data": [
    {
      "user": "Hunt",
      "success": 18,
      "failure": 12,
    },
    {
      "user": "Juliette",
      "success": 9,
      "failure": 14,
    }
  ]
}

what should I do
current response

[
    {
      "user": "Hunt",
      "success": 18,
      "failure": 12,
    },
    {
      "user": "Juliette",
      "success": 9,
      "failure": 14,
    }
  ]

It should be under data:

Please suggest me any solution

Thank you!!!

You can’t put your entire dataset in a single object (unless its very small), but you can nest fields in an array by doing something like this: Mockaroo - Random Data Generator and API Mocking Tool | JSON / CSV / SQL / Excel

1 Like