我想解析JSON,使用Objective-C這是NSLog以我當前的代碼進行回聲。解析JSON - Objective C
{
KnowledgeBaseEntry = {
AllowBotAccess = 1;
FulltextSearch = 1;
GroupId = "";
Id = 611552aea1fe4d789e31133d3ee77f35;
IsPublic = 1;
Languages = "";
OwnerId = 8c427d5;
ParentId = 1;
ShortcutWord = "";
Tags = "";
Title = "Another Test Cell";
Type = 1;
Value = "This <BR>Is<BR>testing";
};
},
{
KnowledgeBaseEntry = {
AllowBotAccess = 1;
FulltextSearch = 1;
GroupId = "";
Id = fc4f1a90243246bb93641b0c8db689b9;
IsPublic = 1;
Languages = "";
OwnerId = 8c427d5;
ParentId = 1;
ShortcutWord = "";
Tags = "";
Title = "Cydo Error 2";
Type = 1;
Value = "content<BR><BR>this is contenty";
};
},
{
KnowledgeBaseEntry = {
AllowBotAccess = 1;
FulltextSearch = 1;
GroupId = "";
Id = bd057d5443194d7a98c2398e07de919e;
IsPublic = 1;
Languages = "";
OwnerId = 8c427d5;
ParentId = 1;
ShortcutWord = "";
Tags = "";
Title = testkb2;
Type = 1;
Value = "test content!";
};
}
)
我需要使用的標題來吸引什麼是價值,所以我可以在應用中展示。我可以訪問Title Var,但我不知道如何將兩者匹配到NSLog Value。任何幫助表示讚賞。
下面是當前的代碼:
NSData *rGeniusData = [[NSData alloc] initWithContentsOfURL:
[NSURL URLWithString:@"http://jbbar.ml/rgenius/ipapi.php"]];
//Parse The JSON
NSError *error;
NSMutableDictionary *allKB = [NSJSONSerialization JSONObjectWithData:rGeniusData
options:NSJSONReadingMutableContainers
error:&error];
NSArray *kb = allKB[@"KnowledgeBaseEntries"];NSLog(@"AboveDP= %@", kb);
你想要什麼?你想匹配你想從nslog中選擇你的值的值嗎? –
我已經將標題導入到UITableView中 –
我已經將標題導入到UITableView中,並且在select中,我希望能夠使用標題Var我必須匹配的值,因此當我加載新的視圖時,我可以打印價值本身。 「另一個測試小組」; Value =「內容
這是內容」; 我現在在使用:NSArray * kbc = [allKB [@「KnowledgeBaseEntries」] objectAtIndex:0];得到一個結果。 IE: –