In my project I use TouchJSON to deserialize a JSON string. The result is a pretty NSDictionary. I would like to get the data in this dictionary into my domain objects / data objects.
Is there a good way to do this? Some best practices?
Perhaps the best to keep the NSDictionary and skip the domain objects?
There are two approaches here. Either add an
-initWithJSONString:method to your data objects and pass the JSON directly to them for break-down, or add an-initWithAttributes:method that takes a dictionary that you get from parsing the JSON. For example:Creating an
-initWithJSONString:method would be very similar.