# How to generate 3 random data in response body

**URL:** <https://community.postman.com/t/how-to-generate-3-random-data-in-response-body/22944>\
**Category:** Help Hub\
**Tags:** tests, variables, scripts, testscripts, pre-request-script\
**Created:** [April 21, 2021, 11:07am UTC](https://community.postman.com/t/how-to-generate-3-random-data-in-response-body/22944 "2021-04-21T11:07:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![navigation-operator](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/navigation-operator/32/8186_2.png) [@navigation-operator](https://community.postman.com/u/navigation-operator)\
**Post date:** [April 21, 2021, 11:07am UTC](https://community.postman.com/t/how-to-generate-3-random-data-in-response-body/22944/1 "2021-04-21T11:07:11Z")

</div>

**Your question may already have an answer on the community forum. Please search for related topics, and then read through the [guidelines](https://community.postman.com/t/about-the-just-getting-started-category/37) before creating a new topic.**

> Here’s an outline with best practices for making your inquiry.

_My question_:  
How can we generate 3 different records in the response body of GET request ?

_Details (like screenshots)_:

I’m trying to send a Get request using mock server. Lets say im sending /user/userdata Get request and i have added an example to this request and have set the status as 200 OK.  
[{  
“Id”: {{$randomInt}},  
“CustomerId”: {{$randomInt}},  
“FirstName”: {{$randomNamePrefix}},  
“LastName”: {{$randomNameSuffix}},  
“EmailID”: {{$randomEmail}},  
“MobNumber”: {{$randomPhoneNumber}}  
}]

I will get  
[{  
“Id”: 456,  
“CustomerId”: 23,  
“FirstName”: Max,  
“LastName”: Black,  
“EmailID”: [Max.Black@123.com](mailto:Max.Black@123.com),  
“MobNumber”: 12345789  
}]

What should i do to get  
[{  
“Id”: 456,  
“CustomerId”: 23,  
“FirstName”: Max,  
“LastName”: Black,  
“EmailID”: [Max.Black@123.com](mailto:Max.Black@123.com),  
“MobNumber”: 12345789  
},  
{  
“Id”: 234,  
“CustomerId”: 233,  
“FirstName”: Maxie,  
“LastName”: McBlack,  
“EmailID”: [Max.Black22@123.com](mailto:Max.Black22@123.com),  
“MobNumber”: 1123457839  
},  
{  
“Id”: 123,  
“CustomerId”: 23,  
“FirstName”: Maxxre,  
“LastName”: Gold,  
“EmailID”: [Maximum.Black@123.com](mailto:Maximum.Black@123.com),  
“MobNumber”: 1234500789  
}  
]

_How I found the problem_:

_I’ve already tried_:

---

<div class="post-metadata">

**Author:** ![neilstudd](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/neilstudd/32/8213_2.png) [@neilstudd](https://community.postman.com/u/neilstudd)\
**Post date:** [April 21, 2021, 7:18pm UTC](https://community.postman.com/t/how-to-generate-3-random-data-in-response-body/22944/2 "2021-04-21T19:18:54Z")

</div>

Hi, if you want 3 random examples within your response, the easiest way would be to code the response to include 3 random examples 🙂 Like this:

> **Example Response**
>
> ```
> [{
> "Id": {{$randomInt}},
> "CustomerId": {{$randomInt}},
> "FirstName": "{{$randomFirstName}}",
> "LastName": "{{$randomLastName}}",
> "EmailID": "{{$randomEmail}}",
> "MobNumber": "{{$randomPhoneNumber}}"
> },{
> "Id": {{$randomInt}},
> "CustomerId": {{$randomInt}},
> "FirstName": "{{$randomFirstName}}",
> "LastName": "{{$randomLastName}}",
> "EmailID": "{{$randomEmail}}",
> "MobNumber": "{{$randomPhoneNumber}}"
> },{
> "Id": {{$randomInt}},
> "CustomerId": {{$randomInt}},
> "FirstName": "{{$randomFirstName}}",
> "LastName": "{{$randomLastName}}",
> "EmailID": "{{$randomEmail}}",
> "MobNumber": "{{$randomPhoneNumber}}"
> }]
> 
> ```

Which generates this output:

> **Generated Response**
>
> ```
> [{
> "Id": 474,
> "CustomerId": 365,
> "FirstName": "Torrey",
> "LastName": "Marks",
> "EmailID": "Junius.Kulas@gmail.com",
> "MobNumber": "831-839-3312"
> },{
> "Id": 429,
> "CustomerId": 635,
> "FirstName": "Khalil",
> "LastName": "Bartoletti",
> "EmailID": "Eleonore.Ondricka@gmail.com",
> "MobNumber": "996-417-3307"
> },{
> "Id": 396,
> "CustomerId": 853,
> "FirstName": "Jerrold",
> "LastName": "Toy",
> "EmailID": "Keshawn.Funk@hotmail.com",
> "MobNumber": "796-698-1469"
> }]
> 
> ```

If you want a way to programmatically generate _x_ objects in your response, I’m not familiar of a way of doing this, hence I’m sharing this in case somebody comes along with a better solution for that!
