let jsonStr = "[{\"takeOffCity\": \"天津 —— 广州\",\"number\": \"123456\"}, {\"takeOffCity\": \"北京 —— 南京\",\"number\": \"001\"}, {\"takeOffCity\": \"威斯汀(北京市丰台区北京西站南路与山西路交叉口)\",\"number\": \"001\"}]"
//解析
tableItems = MyOrderModel.mj_objectArray(withKeyValuesArray: jsonStr)
//转成model
for i in 0...tableItems.count-1 {
let model:MyOrderModel = tableItems[i] as! MyOrderModel
orderArr.append(model)
}
let jsonStr="{\"orderNo\":\"10000010100\",\"orderTime\":\"2018-05-20\",\"peopleArr\":[{\"orderNo\":\"123\",\"orderTime\":\"12345678909876\",\"insure\":\"已同意\"},{\"orderNo\":\"aaaaa\",\"orderTime\":\"E1243445\",\"insure\":\"已拒绝\"},{\"orderNo\":\"456\",\"orderTime\":\"dfffdsfds\",\"insure\":\"已同意\"}],\"insure\":\"航空意外险\",\"conactPeople\":{\"orderNo\":\"联系人姓名\",\"orderTime\":\"12345678909876\",\"insure\":\"111@qq.com\"}}"
orderModel=OrderDetailModel.mj_object(withKeyValues: jsonStr)
oneRow.removeAll()
oneRow.append( ["title":"订单单号","content":orderModel.orderNo])
oneRow.append(["title":"创建时间","content":orderModel.orderTime])
oneRow.append(["title":"成本中心","content":orderModel.orderTime])
oneRow.append(["title":"预订人","content":orderModel.orderTime])
oneRow.append(["title":"差旅标准","content":orderModel.orderTime])
towRow=OrderDetailModel.mj_objectArray(withKeyValuesArray: orderModel.peopleArr)
model.swift
var peopleArr : AnyObject!