I have some rather complex sorting to do.
Given an array of hashes, I need to sort the hashes within the array, based on a value in a key of each hash.
For example (given in JSON format):
"instruments":[
{"id":1,"title":"Piano","token":"piano","count":13},
{"id":6,"title":"Bass Guitar","token":"bass","count":12},
{"id":11,"title":"Viola","token":"viola","count":12},
{"id":4,"title":"Synth","token":"synth","count":11},
{"id":3,"title":"Keyboard","token":"keyboard","count":9},
{"id":7,"title":"Saxophone","token":"saxophone","count":8},
{"id":12,"title":"Flute","token":"flute","count":8},
{"id":5,"title":"Drums","token":"drums","count":6},
{"id":2,"title":"Guitar","token":"guitar","count":5},
{"id":8,"title":"Violin","token":"violin","count":5},
{"id":9,"title":"Vocals","token":"vocals","count":4},
{"id":10,"title":"Cello","token":"cello","count":4}
]
This JSON is the result of a responds_with in Rails. Before it gets to that, I'd like to switch these hashes around in the array, based on the alphabetical order of the "title" key in each hash.
Here's a screenshot of a part of the JSON (in Firebug) to better illustrate what I mean:

Any help would be greatly appreciated.
Thanks!