{"action":"created","issue":{"url":"https://api.github.com/repos/icanzilb/JSONModel/issues/303","labels_url":"https://api.github.com/repos/icanzilb/JSONModel/issues/303/labels{/name}","comments_url":"https://api.github.com/repos/icanzilb/JSONModel/issues/303/comments","events_url":"https://api.github.com/repos/icanzilb/JSONModel/issues/303/events","html_url":"https://github.com/icanzilb/JSONModel/issues/303","id":63790672,"number":303,"title":"Optional and Ignore are not respected","user":{"login":"gtas-sunshine","id":11354498,"avatar_url":"https://avatars.githubusercontent.com/u/11354498?v=3","gravatar_id":"","url":"https://api.github.com/users/gtas-sunshine","html_url":"https://github.com/gtas-sunshine","followers_url":"https://api.github.com/users/gtas-sunshine/followers","following_url":"https://api.github.com/users/gtas-sunshine/following{/other_user}","gists_url":"https://api.github.com/users/gtas-sunshine/gists{/gist_id}","starred_url":"https://api.github.com/users/gtas-sunshine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gtas-sunshine/subscriptions","organizations_url":"https://api.github.com/users/gtas-sunshine/orgs","repos_url":"https://api.github.com/users/gtas-sunshine/repos","events_url":"https://api.github.com/users/gtas-sunshine/events{/privacy}","received_events_url":"https://api.github.com/users/gtas-sunshine/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-23T17:59:02Z","updated_at":"2015-12-17T11:21:04Z","closed_at":"2015-12-17T11:21:04Z","body":"I have these properties in the header file.\r\n\r\n@property (copy, nonatomic) NSString<Optional>* guidId;\r\n@property (copy, nonatomic) NSDate* created_at;\r\n@property (copy, nonatomic) NSNumber<Ignore>* longitude;\r\n@property (copy, nonatomic) NSNumber<Ignore>* latitude;\r\n@property (copy, nonatomic) NSNumber* altitude;\r\n@property (copy, nonatomic) NSNumber* relative_altitude;\r\n@property (copy, nonatomic) NSNumber* value;\r\n@property (copy, nonatomic) NSString<Optional>* scale;\r\n@property (copy, readonly, nonatomic, getter=getReadingTypeDescription) NSString* name;\r\n@property (assign, nonatomic) WEEReadingType readingType;\r\n@property (copy, nonatomic) NSString* name;\r\n@property (strong, nonatomic) NSMutableArray* location;\r\n\r\nThough it is strange Optional and Ignore are not respected.\r\n\r\nIn the implementation file I override these two methods.\r\n\r\n// This one because when converting to JSON from Model I need specific properties only and Ignore is  not for this purpose\r\n- (NSString *)toJSONString\r\n    {\r\n    return [super toJSONStringWithKeys:\r\n        @[\r\n        @\"guidId\",\r\n        @\"location\",\r\n        @\"altitude\",\r\n        @\"relative_altitude\",\r\n        @\"scale\",\r\n        @\"name\",\r\n        @\"value\",\r\n        @\"created_at\"\r\n        ]];\r\n    }\r\n\r\n// And this one for the enum property that I want to ignore, but I found out I get an error when using [JSONModel arrayOfModelsFromDictionaries:json error:&error] that Optional or Ignore is not respected.\r\n+ (BOOL)propertyIsIgnored:(NSString *)propertyName\r\n    {\r\n    if ([propertyName isEqualToString:@\"readingType\"] ||\r\n        [propertyName isEqualToString:@\"guidId\"] ||\r\n        [propertyName isEqualToString:@\"longitude\"] ||\r\n        [propertyName isEqualToString:@\"latitude\"])\r\n        {\r\n        return YES;\r\n        }\r\n    return NO;\r\n    }\r\n\r\nExample of JSON I need to convert to my model.\r\n\r\n[\r\n  {\r\n    \"created_at\": \"2015-03-20T19:26:28.000Z\",\r\n    \"location\": [\r\n      40.70739851802653,\r\n      -74.005788154969\r\n    ],\r\n    \"altitude\": 4.063048774263429,\r\n    \"relative_altitude\": 0.0,\r\n    \"name\": \"pressure\",\r\n    \"value\": 1014.718704223633,\r\n    \"scale\": \"mb\"\r\n  },\r\n  {\r\n    \"created_at\": \"2015-03-20T19:26:28.000Z\",\r\n    \"location\": [\r\n      40.70739851802653,\r\n      -74.005788154969\r\n    ],\r\n    \"altitude\": 4.063048774263429,\r\n    \"relative_altitude\": 0.0,\r\n    \"name\": \"pressure\",\r\n    \"value\": 1014.718704223633,\r\n    \"scale\": null\r\n  }\r\n]\r\n\r\nThe above with [JSONModel arrayOfModelsFromDictionaries:json error:&error] will throw the following error.\r\n\r\nError Domain=JSONModelErrorDomain Code=1 \"Invalid JSON data: Value of required model key scale is null\" UserInfo=0x170265cc0 {NSLocalizedDescription=Invalid JSON data: Value of required model key scale is null, kJSONModelKeyPath=[46].scale}\r\n\r\nAny ideas what is wrong?"},"comment":{"url":"https://api.github.com/repos/icanzilb/JSONModel/issues/comments/165428028","html_url":"https://github.com/icanzilb/JSONModel/issues/303#issuecomment-165428028","issue_url":"https://api.github.com/repos/icanzilb/JSONModel/issues/303","id":165428028,"user":{"login":"billinghamj","id":905772,"avatar_url":"https://avatars.githubusercontent.com/u/905772?v=3","gravatar_id":"","url":"https://api.github.com/users/billinghamj","html_url":"https://github.com/billinghamj","followers_url":"https://api.github.com/users/billinghamj/followers","following_url":"https://api.github.com/users/billinghamj/following{/other_user}","gists_url":"https://api.github.com/users/billinghamj/gists{/gist_id}","starred_url":"https://api.github.com/users/billinghamj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/billinghamj/subscriptions","organizations_url":"https://api.github.com/users/billinghamj/orgs","repos_url":"https://api.github.com/users/billinghamj/repos","events_url":"https://api.github.com/users/billinghamj/events{/privacy}","received_events_url":"https://api.github.com/users/billinghamj/received_events","type":"User","site_admin":false},"created_at":"2015-12-17T11:21:04Z","updated_at":"2015-12-17T11:21:04Z","body":"Looks as though this has been resolved in the Stack Overflow post."}}