Storing json data on iPhone: save the json string since VS creates an object from json and uses NSCoding + NSKeyedArchiver

In my iPhone application, I get json data from a remote server, parse it using the Json Framework, and present it in UIview. I also want to be able to provide the user with the ability to store data on the device so that it can also be viewed offline. I was wondering if saving json data directly is a better or worse choice than creating an object and then saving it using NSCoding + NSKeyedArchiver. I believe that the advantage of storing a json string is that it takes up less disk space than an archive object, and on the other hand, by storing archive objects you do not need to analyze the stored data every time, using less memory.

Is there a better general choice? Are there any recommendations on this? The json files are approximately 8 KB in size.

+5
source share
1 answer

I use a different approach. When JSON data is parsed in my application, it is stored in NSDictionary. I save this as a .plist file.

[myDictionary writeToFile:[self saveFilePath] atomically:YES];

Download:

NSMutableDictionary *wholeDictionary = [NSDictionary dictionaryWithContentsOfFile:[self saveFilePath]];

What is it!

+6
source

All Articles