class RoomType: Mappable {
var data: [String: Room]?
required init?(map: Map) {
}
// Mappable
func mapping(map: Map) {
data <- map["roomType"]
}
}
class Room: Mappable {
var name: String?
required init?(map: Map) {
}
// Mappable
func mapping(map: Map) {
name <- map["name"]
}
}
What you did:
if let result = Mapper<RoomType>().map(JSONObject: json) {
if let data = result.data {
for (key, value) in data {
print(key)
}
}
}
What you expected:
What I expect is, I want to get the order exactly like json string
"SSS", "ABC", "SXW"
What you got:
"SXW", "ABC", "SSS"
What I get is dynamic order due to dictionary container. So, is there any way to parse unknown dynamic key with the server JSON response provided order? Like Android Map?
Your JSON dictionary:
Your model:
What you did:
What you expected:
What I expect is, I want to get the order exactly like json string
What you got:
What I get is dynamic order due to dictionary container. So, is there any way to parse unknown dynamic key with the server JSON response provided order? Like Android Map?