class LeadsEntity: NSObject, Mappable {
var name: String?
var mobile: String?
var address: String?
var coords: String?
var stime: String?
override init() {}
required init?(map: Map) {}
func mapping(map: Map) {
name <- map["name"]
mobile <- map["mobile"]
address <- map["address"]
coords <- map["coords"]
stime <- map["stime"]
}
}
I am using this method to convert model to json string
func json(from object: Any) -> String? {
let JSONString = (object as! [LeadsEntity]).toJSONString(prettyPrint: true)?.replacingOccurrences(of: "\n", with: "").replacingOccurrences(of: " ", with: "")
return JSONString
}
I am not able to remove \ and I also tried to remove by .replacingOccurrences(of: "\", with: "", options: NSString.CompareOptions.literal, range:nil) but no success. Thanks in advance.