# How dynamic array response verified

**URL:** <https://community.postman.com/t/how-dynamic-array-response-verified/16544>\
**Category:** Help Hub\
**Created:** [October 7, 2020, 1:15pm UTC](https://community.postman.com/t/how-dynamic-array-response-verified/16544 "2020-10-07T13:15:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aakashjain8693](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@aakashjain8693](https://community.postman.com/u/aakashjain8693)\
**Post date:** [October 7, 2020, 1:15pm UTC](https://community.postman.com/t/how-dynamic-array-response-verified/16544/1 "2020-10-07T13:15:06Z")

</div>

Hi All,  
I want to verify my response in dynamic way, Response is basically in array format and array value gonna be change everytime.  
Note: I am following data driven approach with .csv file so data already upto date in .csv file with queries.

response:  
[ {  
“id”: 7593401,  
“orderNumber”: “32051746”  
},  
{  
“id”: 7593401,  
“orderNumber”: “29904051”,

```
}

```

]  
OR  
Repsonse:  
[ {  
“id”: 7593401,  
“orderNumber”: “32051746”  
}  
]  
You can see array response change ,who we can assert in Tests area in Postman?

.CSV file:

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/8/b/8bb952fdceec9cdf952db77ab89784578a82f659.png)

---

<div class="post-metadata">

**Author:** ![michal.robaszewski.j](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michal.robaszewski.j/32/5378_2.png) [@michal.robaszewski.j](https://community.postman.com/u/michal.robaszewski.j)\
**Post date:** [October 7, 2020, 3:11pm UTC](https://community.postman.com/t/how-dynamic-array-response-verified/16544/2 "2020-10-07T15:11:38Z")

</div>

Hi,  
You can save first response as stringify Json variable. And after second request compare them.

> **First Request**
>
> ```auto
> var req = pm.response.json();
> pm.collectionVariables.set('XYZ_Model', JSON.stringify(req));
> 
> ```

> **Second Request compare as string**
>
> ```auto
> const fReq= pm.collectionVariables.get("XYZ_Model")
> var req = pm.response.json();
> 
> pm.expect(fReq).to.equal(JSON.stringify(req)) ; 
> 
> ```

> **Second Request compare as objects**
>
> ```auto
> const fReq= pm.collectionVariables.get("XYZ_Model")
> var req = pm.response.json();
> 
> pm.expect( JSON.parse(fReq)).to.deep.equal(req) ; 
> 
> ```

This is the simplest approach.

When data in response may change?

If you are new, please seek help in the #just-getting-started topic.

---

<div class="post-metadata">

**Author:** ![aakashjain8693](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@aakashjain8693](https://community.postman.com/u/aakashjain8693)\
**Post date:** [October 8, 2020, 11:29am UTC](https://community.postman.com/t/how-dynamic-array-response-verified/16544/3 "2020-10-08T11:29:35Z")

</div>

Not fully understand, Any suggested links?  
@allenheltondev Anything do you have?

---

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [October 8, 2020, 11:42am UTC](https://community.postman.com/t/how-dynamic-array-response-verified/16544/4 "2020-10-08T11:42:44Z")

</div>

I don’t fully understand your problem.

Is the API you a hitting using values from your csv in the request? I don’t know what you’re trying to verify. Screenshots of the request and what you’re trying to test would be helpful.

---

<div class="post-metadata">

**Author:** ![aakashjain8693](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@aakashjain8693](https://community.postman.com/u/aakashjain8693)\
**Post date:** [October 8, 2020, 12:24pm UTC](https://community.postman.com/t/how-dynamic-array-response-verified/16544/5 "2020-10-08T12:24:52Z")

</div>

If you see my response, Always Array values different based on the input so how I can write my optimized script?And how I can arrange my data in .csv file?  
P.S. I am verifying response data through .csv file.

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/0/6/060f729a6d323a783c700c2cdf7589bb44b951dc.png)  
Let me know still need further update.

---

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [October 9, 2020, 11:22am UTC](https://community.postman.com/t/how-dynamic-array-response-verified/16544/6 "2020-10-09T11:22:28Z")

</div>

In an ideal scenario, what would happen here? I don’t understand what your request is doing.

Are you sending a request with params from your csv, then using other params in the csv to validate the response?

Do you need to find a specific object in the response array and validate it? Do you need to validate all of them? Just the first one?
