Data from data files is often loaded into a non-mutable, 'nested' structure of arrays and dictionaries. This non-mutable structure leaves the data un-editable. In this recipe, we will read in a nested JSON data structure and then recursively re-create the data using mutable data structures to allow the data to be edited.
Execute the following code:
#import "GameHelper.h" //Implementation @implementation Ch3_MutatingNestedMetadata -(CCLayer*) runRecipe { [super runRecipe]; //Load JSON data NSString *fileName = @"data_to_mutate.json"; NSString *jsonString = [[[NSString alloc] initWithContentsOfFile:getActualPath(fileName) encoding:NSUTF8StringEncoding error:nil] autorelease]; NSData *jsonData = [jsonString dataUsingEncoding:NSUTF32BigEndianStringEncoding]; NSDictionary *dict = [[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData...