0
我想返回原生JSON字符串以存儲在Realm中,因爲Realm不能存儲本機對象的集合。使用Swift ObjectMapper庫訪問映射中的JSONString
例JSON: { "root": { "id":1, "name":"name", "array":["a", "b", "c"] }}
func mapping(map:Map) {
id <- map["id]
name <- map["name"]
array <- map["array"].JSONString // array = "[\"a\", \"b\", \"c\"]"
}
這可能嗎?在github上https://github.com/Hearst-DD/ObjectMapper/issues/730