Closed ValentinStrazdin closed 6 years ago
I don’t think this is a bug. If the json from the server contains a key with the value nil, the corresponding property must be set to nil too.
Why should groot ignore nil values in Json? The only ignored keys are those which are not included in the Json.
As @ManueGE says, if the JSON has explicit null
attributes, it is not a bug. It would be a bug if a partial update would nullify all the attributes not present in the JSON.
@ValentinStrazdin As a suggestion, if you want to achieve this behaviour, you can still use a JSONDictionaryTransformerName
annotation, and remove the keys whose value is null
from the dictionary. This way, they will be ignored.
I have NSManagedObject with identity attribute. This object has several nullable properties. I set values for these properties and save NSManagedObjectContext. When I get JSON from server containing list of objects I want to merge these changes with my existing objects. Although corresponding attributes are null my saved properties are replaced with these nulls.
I looked through your code and found the following bug in file "NSManagedObject+Groot.m" line 167:
So my case is not correctly processed by this code.
Could you replace it with: