# Test script to check the json data displayed alphabetically

**URL:** <https://community.postman.com/t/test-script-to-check-the-json-data-displayed-alphabetically/34519>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [April 15, 2022, 6:12pm UTC](https://community.postman.com/t/test-script-to-check-the-json-data-displayed-alphabetically/34519 "2022-04-15T18:12:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![descent-module-cand6](https://avatars.discourse-cdn.com/v4/letter/d/ee7513/32.png) [@descent-module-cand6](https://community.postman.com/u/descent-module-cand6)\
**Post date:** [April 15, 2022, 6:12pm UTC](https://community.postman.com/t/test-script-to-check-the-json-data-displayed-alphabetically/34519/1 "2022-04-15T18:12:55Z")

</div>

Hello,  
How to write a test script to validate the JSON data members are listed alphabetically. Would like to make this as a generic script so that this can be used with any JSON data result.

Example:  
{  
“name”: “Jane”,  
“age”: 29,  
“hobbies”: [  
“skating”,  
“painting”  
],  
“email”: null  
}  
The above result will fail since name, age, hobbies and email are not listed alphabetically.  
TY

---

<div class="post-metadata">

**Author:** ![bpricilla](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/bpricilla/32/6511_2.png) [@bpricilla](https://community.postman.com/u/bpricilla)\
**Post date:** [April 16, 2022, 9:11am UTC](https://community.postman.com/t/test-script-to-check-the-json-data-displayed-alphabetically/34519/2 "2022-04-16T09:11:31Z")

</div>

@descent-module-cand6 Welcome to the community 🥳

I doubt this can be done directly. May be you can sort the keys and store in a variable and try to validate it against the original response.

Found a similar thread [here](https://community.postman.com/t/sort-json-response/32632/5). please check if that helps 😊
