我得到我的json響應並解析它,我能夠分別獲取以下模型和標識符(請參閱下文)。 現在,我只需要按照模型對它們進行排序,不區分大小寫。所以,如果我創建一個數組,那麼即使不是不可能,也很難按照模型進行排序,如果我做了散列,我將無法創建重複的鍵(模型)。
那麼排序這個json響應的最佳方法是什麼?謝謝 !!Ruby:如何使用數組或哈希映射對json響應進行排序
this is the model: 1 Series
this is the identifier: Convertible
this is the model: 1 Series
this is the identifier: Coupe
this is the model: 1 Series M
this is the identifier: Coupe
this is the model: 3 Series
this is the identifier: Convertible
this is the model: 3 Series
this is the identifier: Coupe
this is the model: 3 Series
this is the identifier: Diesel
this is the model: 3 Series
this is the identifier: Sedan
this is the model: 3 Series
this is the identifier: Wagon
this is the model: ALPINA B7
this is the identifier: Sedan
this is the model: ActiveHybrid 5
this is the identifier: Sedan
this is the model: ActiveHybrid 7
this is the identifier: Sedan
this is the model: ActiveHybrid X6
this is the identifier: SUV
但是你試過了什麼?歡迎! – megas 2012-07-27 19:08:08