I have a scenario of order by name in Jmeter for one of the APIs.
the response of the API for the get name order by name returned a response like below,
{"value":[{"ID":"efe36a3b-8e7a-4850-a580-b9821195daca","name":"Harry"},{"ID":"efe36a3b-9e7a-4850-a580-b9821195dacb","name":"Jerry"},{"ID":"efe36a3b-8f7a-4850-a580-b9821195dacc","name":"Kate"},{"ID":"efe36a3b-8g7a-4850-a580-b9821195dacd","name":"Louis"}],"next":"https://localhost:8080/v1/empNames?$skip=20&$orderby=id desc"}
Now I want to validate are the name and ID's are in ascending order.
It seems you're looking for String.compareTo() function
Compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings. The character sequence represented by this String object is compared lexicographically to the character sequence represented by the argument string. The result is a negative integer if this String object lexicographically precedes the argument string. The result is a positive integer if this String object lexicographically follows the argument string. The result is zero if the strings are equal; compareTo returns 0 exactly when the equals(Object) method would return true.
More information: