# Need to help in automating the json response which doesnot contains array

**URL:** <https://community.postman.com/t/need-to-help-in-automating-the-json-response-which-doesnot-contains-array/3146>\
**Category:** Help Hub\
**Created:** [November 1, 2018, 4:54am UTC](https://community.postman.com/t/need-to-help-in-automating-the-json-response-which-doesnot-contains-array/3146 "2018-11-01T04:54:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![prashanthpatil](https://avatars.discourse-cdn.com/v4/letter/p/ed655f/32.png) [@prashanthpatil](https://community.postman.com/u/prashanthpatil)\
**Post date:** [November 1, 2018, 4:54am UTC](https://community.postman.com/t/need-to-help-in-automating-the-json-response-which-doesnot-contains-array/3146/1 "2018-11-01T04:54:13Z")

</div>

Hi ,

I am trying to fetech the data from the postman which is not present as array. Can you please help me with the same.

I need to validate whether mealcode is present or not in ST2 & ST1

Please help me with the same

“ABC”: {  
“B”: {  
“ST2”: {  
“meals”: {  
“bookingClass”: “R”,  
“mealCodes”: [  
“H”,  
“H”  
]  
}  
},  
“ST1”: {  
“meals”: {  
“bookingClass”: “R”,  
“mealCodes”: [  
“H”,  
“H”  
]  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![singhsivcan](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/singhsivcan/32/1595_2.png) [@singhsivcan](https://community.postman.com/u/singhsivcan)\
**Post date:** [November 1, 2018, 5:48am UTC](https://community.postman.com/t/need-to-help-in-automating-the-json-response-which-doesnot-contains-array/3146/2 "2018-11-01T05:48:40Z")

</div>

Hi @prashanthpatil, will the response structure be the same?  
Or is it subject to change?

Also, you need to test if `mealCodes` property exists and the type is that of an array, correct?

---

<div class="post-metadata">

**Author:** ![tmccann](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/tmccann/32/3550_2.png) [@tmccann](https://community.postman.com/u/tmccann)\
**Post date:** [November 1, 2018, 7:02pm UTC](https://community.postman.com/t/need-to-help-in-automating-the-json-response-which-doesnot-contains-array/3146/3 "2018-11-01T19:02:55Z")

</div>

@prashanthpatil Do you need to simply validate that each of `ST1` and `ST2` have the mealCodes object in the response or do you need to validate the content in those objects?

You could do come sort of JSON validation like this …

```
pm.test("Validate Response Body Is Correct", function () {
    var jsonData = pm.response.json();
    pm.expect(jsonData.ABC.B.ST2.meals.mealCodes()).to.include("H");
    pm.expect(jsonData.ABC.B.ST1.meals.mealCodes()).to.include("H");
}); 

```

Or something along those lines maybe?
