There is a function:
sort: function (jsonData) { return jsonData.sort(function(a,b){ return (a < b.id) ? -1:1; }); },
Displays error: TypeError: jsonData.sort is not a function
.
I understand that the sort function does not work with objects.
But I don’t understand how to return a sorted array (or object).
Example jsonData:
Object{ 131:Object 132:Object 136:Object 139:Object 142:Object 143:Object 144:Object }
I want a reverse sort.
This is not a duplicate. Re-sort json jquery result by a specific field , it is sorted by value, and I need by key. Moreover, the .sort function is shown there, and as I said, the function displays an error. I already wrote about this in the comments. Read fully before indicating that this is a duplicate!