如何将NSArray或NSDictionary保存到JSON文件?

For*_*est 4 xml serialization json ios

JSONKit提供了解码JSON文件的绝佳方法,将对象编码为JSON文件的相反方式的最佳方法是什么?
BTW:这是使用XML加载和保存的教程.

谢谢

Ben*_*n G 11

iOS 5现在拥有了所需的一切:

NSError *error = nil;
NSOutputStream *outputStream = [NSOutputStream outputStreamToFileAtPath:filepath append:yesOrNo];
[outputStream open];

[NSJSONSerialization writeJSONObject:nsDicOrNSArrayObject 
                            toStream:outputStream 
                             options:0 
                               error:&error];
[outputStream close];
Run Code Online (Sandbox Code Playgroud)