ios - Object from JSON with Mantle: ignore a property -


my app creates objc objects json. things working fine, until added new property objc model class, doesn't have counterpart in json.

i've configured mapping follows:

+ (nsdictionary *)jsonkeypathsbypropertykey {     return @{              @"firstname"                   : @"firstname",              @"middlename"                  : @"middlename",              @"lastname"                    : @"lastname",              // etc.              @"phonenumber"                 : nsnull.null // no json data 1              }; } 

however assertion failure in mantle, in mtljsonadapter initwithmodelclass: "phonenumber must either map json key path or json array of key paths, got: null."

this how create model object:

mydata *mydata = [mtljsonadapter modelofclass:[mydata class]                             fromjsondictionary:json error:&error]; 

how can have phonenumber property in data class without mapping json value?

just don't specify mapping + jsonkeypathsbypropertykey.


Comments

Popular posts from this blog

java - HTTP Status 500 - An exception occurred processing JSP page /second.jsp at line 15 -

SQL Server - MyCTE query based on 24 hour period (next day) -

php - Using str_replace to translate a MySQL Table in html -