ios - Error Domain=NSCocoaErrorDomain Code=3840 "No string key for value in object around character 1." -


this json string returned server. trying map object mapper class , print values following error.

error domain=nscocoaerrordomain code=3840 "no string key value in object around character 1."

{'status': false, 'updatedstatus': true, 'connectionstatus': true} 

and following mapper class

public class info: mappable {       internal let kstatuskey: string = "status"     internal let kconnectionstatuskey: string = "connectionstatus"     internal let kupdatedstatuskey: string = "updatedstatus"       // mark: properties     public var status: string?     public var connectionstatus: string?     public var updatedstatus: string?        // mark: objectmapper initalizers     /**      map json object class using objectmapper      - parameter map: mapping objectmapper      */     required public init?(_ map: map){      }      /**      map json object class using objectmapper      - parameter map: mapping objectmapper      */     public func mapping(map: map) {         status <- map[kstatuskey]         connectionstatus <- map[kconnectionstatuskey]         updatedstatus <- map[kupdatedstatuskey]      } } 

i cannot change string returned server, there way can fix code. appreciated. thank you.

your json should this

{ "status": false, "updatedstatus": true, "connectionstatus": true }

update mapper upon this.


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -