所以我有一个哈希数组:
[{"id":"30","name":"Dave"},
{"id":"57","name":"Mike"},
{"id":"9","name":"Kevin"},
...
{"id":"1","name":"Steve"}]
我想按id
属性对其进行排序,使其看起来像这样:
[{"id":"1","name":"Steve"},
{"id":"2","name":"Walter"},
...
{"id":"60","name":"Chester"}]
我假设我使用该sort_by
方法,但我不确定该怎么做。