I have a JSON object generated based on data stored in a table. I then need to be able to sort it in different ways, but when I do JSON.stringify(array) and try
If your intent is to allow the user to sort the table dynamically, then my approach may be slightly different.
There are plenty of jQuery table sorting plugins. I have had good success with this one: http://tablesorter.com/docs/
Allows multi-column sort, a default sort, wire up to events, etc... etc...
This way you can build your table as you already are, and sorting can be done secondary even before page output.