Is there a way to sort a JSON response object array in a specific order, especially when dealing with non-English characters like Umlauts?
object {
item: 1,
users: [
{name: "A", age: "23"},
{name: "B", age: "24"},
{name: "Ä", age: "27"}
]
}
Expected name sorting would be A, Ä, and B.
Upon attempting to use localeCompare()
for sorting:
object.sort(function (a, b) { return a.localeCompare(b); });
An error is encountered stating that object.sort
is not a function. Is there an alternate method to sort the object array?