Objective c 如何解析这个

Objective c 如何解析这个,objective-c,json,parsing,Objective C,Json,Parsing,我正在试验Google url缩写器goo.gl,目前它将url发送到goo.gl并返回以下内容: { "kind": "urlshortener#url", "id": "http://goo.gl/kyPI", "longUrl": "http://dsfsd.com/" } 我认为这是JSON,但因为ARC,我在这方面遇到了麻烦。是否还有其他方法可以解析键为“id”的字符串?它是JSON,您可以使用类似SBJson的框架来解析它。请参见它是JSON,您可以使用类似SBJson的框架

我正在试验Google url缩写器goo.gl,目前它将url发送到goo.gl并返回以下内容:

{
 "kind": "urlshortener#url",
 "id": "http://goo.gl/kyPI",
 "longUrl": "http://dsfsd.com/"
}

我认为这是JSON,但因为ARC,我在这方面遇到了麻烦。是否还有其他方法可以解析键为“id”的字符串?

它是JSON,您可以使用类似SBJson的框架来解析它。请参见

它是JSON,您可以使用类似SBJson的框架来解析它。请参见

如果您的应用程序针对iOS 5,您可以使用Apple的class

(假设您收到的数据称为数据)


如果你的应用程序以iOS5为目标,你可以使用Apple的class

(假设您收到的数据称为数据)


为什么ARC和JSON会有问题?大多数JSON框架总是因为某种原因而与ARC发生冲突。NSJSONSerialization内置于ios中,如果外部框架给您带来麻烦,请使用它。@ChristopherHannah只需使用
-fno objc arc
..@RichardJ.RossIII尝试过,但仍然显示arc错误,无法编译。为什么您在使用arc和JSON时会遇到问题?大多数JSON框架在某些情况下都会使用arcreason.NSJSONSerialization内置于ios中,如果外部框架给您带来麻烦,请使用它。@ChristopherHannah只需使用
-fno objc arc
..@RichardJ.RossIII尝试过,但仍然显示arc错误,无法编译。
NSError *error=nil;
    id result=[NSJSONSerialization JSONObjectWithData:theData options:
               NSJSONReadingMutableContainers error:&error];

//to retrieve the 'kind' value of the object
    NSLog("Kind: %@",[result objectForKey:@"kind"]);