Mutating nested metadata

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.

Mutating nested metadata

Getting ready

Please refer to the project RecipeCollection01 for full working code of this recipe.

How to do it...

Execute the following code:

#import "GameHelper.h" //Implementation @implementation Ch3_MutatingNestedMetadata -(CCLayer*) runRecipe { [super runRecipe]; //Load JSON data NSString *fileName = @"data_to_mutate.json"; ...

Get Cocos2d for iPhone 1 Game Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.