如何使用ObjectMapper在RxSwift 3上映射以下Json数组?请帮我。无论如何,谢谢你。
class func getMessagesRequest(parameters: [String: Any]?, headers: [String:String] ) -> Observable<Any> {
return request(.post, kGetMsgHistory , parameters: parameters, encoding: JSONEncoding.default, headers: headers)
.subscribeOn(MainScheduler.asyncInstance)
.flatMap {response ->Observable<Any> in
return response.validate(statusCode: 200..<300)
.validate(contentType: ["application/json","text/json"])
.rx.json()
}
"messages" :
[
{
"drTime" : 1478855430000,
"messageId" : "59257",
"options" : {
"pushBidirectionalUrl" : null,
"img" : "https:\/\/lh3.googleusercontent.com\/K272HPMCfs6k_zqvvt83pzowaIctVT6TO60kM561CWrOxGjePNZfiU-6H0Zj4YHHv9-f=w300-rw",
"caption" : "Posters",
"action" : "https:\/\/details.com?id=com.pomelogames.MarsGame"
}
},
{
"drTime" : 1478855440000,
"messageId" : "59258",
"options" : {
"pushBidirectionalUrl" : null,
"img" : "https:\/\/lh3.googleusercontent.com\/K272HPMCfs6k_zqvvt83pzowaIctVT6TO60kM561CWrOxGjePNZfiU-6H0Zj4YHHv9-f=w300-rw",
"caption" : "Posters",
"action" : "https:\/\/details.com?id=com.pomelogames.MarsGame"
}
},