Check json response - if the tags are sorted by asc or desc

Hi guys, I would like to check (.check) whether a response json from a specific request is sorted by a specific response tag.

e.g. response Json:

name: “a”,
address: “address X”
name: “b”,
address: “address Y”

note that the response is sorted by name… so I need a “.check” structure to test whether or not the response is sorted asc (or desc) by name (in this case) and fail if it is not.

I appreciate your help on that.