roc*_*key 1 iphone parsing json objective-c
我想知道在目标C中解析一个json对象.我通过加载一个url获得了JSON对象.你可以告诉我怎么做或任何样品或任何参考.
以下是json示例.
{
"name":"WFNX",
"now":
{
"id":"17749528",
"song":"Back Down South",
"artist":"Kings Of Leon"
},
"desc":"101.7 - True Alternative",
"audiostream":"http:\/\/www.streamaudio.com\/stations \/asx\/wfnx_fm.asx",
"genre":"Rock",
"tz":"EST",
"id":"17880",
"yes":"station"
}
Run Code Online (Sandbox Code Playgroud)
在code.google.com或Github上查看Objective-C的这个JSON框架.
它非常简单易用.您实例化您的SBJSON对象,然后使用您的缓冲区调用objectWithString:
SBJSON * parser = [[SBJSON alloc] init];
NSString * buffer = @"{"name":"WFNX"}";
NSError* error = NULL;
// the type of json will depend on the JSON data in buffer, in this case, it will be
// and NSDictionary with one key/value pair "name"->"WFNX"
id json = [parser objectWithString:buffer error:&error];
Run Code Online (Sandbox Code Playgroud)
有几个,见:
http://code.google.com/p/json-framework/
http://github.com/schwa/TouchJSON
一个大清单:
是一个很棒的JSON参考站点
| 归档时间: |
|
| 查看次数: |
4220 次 |
| 最近记录: |