如何将Json字符串转换为NSArray?

Seb*_*ldt 2 cocoa-touch json objective-c ios restkit

我目前正在尝试将一些对象的JSON表示转换为NSArray.我使用RestKit通过我们的API获取响应,现在我想将RKResponse转换为一个对象数组.我怎样才能做到这一点 ?

App*_*ate 17

 NSData* data = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
    NSArray *values = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];  // if you are expecting  the JSON string to be in form of array else use NSDictionary instead
Run Code Online (Sandbox Code Playgroud)

以上代码适用于iOS 5及更高版本