You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I want to make any complicated preprocessing on JSON before mapping JSON to RLMObject I can use +preprocessedJSON:, but there is no way for opposite postprocessing of RLMObject to JSON if I want to get the same JSON back from RLMObject.
One way I wanted to achieve that is by overriding -JSONDictionary but it is implemented this way: - (NSDictionary *)JSONDictionary { return [self mc_createJSONDictionary]; }
and everywhere in the implementation -mc_createJSONDictionary is called. So suddenly to achieve what I want I need to override -mc_createJSONDictionary and mess with guts of implementation because -mc_createJSONDictionary is private.
Why can't -JSONDictionary be called directly in the implementation?
Do you have any plans to introduce a symmetric call to +preprocessedJSON:?
Are there any other ways I can achieve desired behaviour?
The text was updated successfully, but these errors were encountered:
pankkor
changed the title
custom RLMObject to JSON mapping (symmetric method to +preprocessedJSON needed)
Custom RLMObject to JSON mapping (symmetric method to +preprocessedJSON needed)
Jun 20, 2016
JSONOutboundMappingDictionary method works fine, just make readonly property with all needed preprocessed data and map it. Some time ago I've made a PR for preprocessing of each object separately #63.
If I want to make any complicated preprocessing on JSON before mapping JSON to RLMObject I can use
+preprocessedJSON:
, but there is no way for opposite postprocessing of RLMObject to JSON if I want to get the same JSON back from RLMObject.One way I wanted to achieve that is by overriding
-JSONDictionary
but it is implemented this way:- (NSDictionary *)JSONDictionary { return [self mc_createJSONDictionary]; }
and everywhere in the implementation
-mc_createJSONDictionary
is called. So suddenly to achieve what I want I need to override-mc_createJSONDictionary
and mess with guts of implementation because-mc_createJSONDictionary
is private.-JSONDictionary
be called directly in the implementation?+preprocessedJSON:
?The text was updated successfully, but these errors were encountered: