[
{
"AT" : null,
"EA" : null,
"AD2" : "",
"OP" : null,
"AdsLst" : [
],
"EMs" : null,
"ND" : {
"MN" : null,
"FN" : "Sony",
"LN" : "J"
},
"ZP" : "23456",
"CT" : 1,
"PP" : 0,
"cId" : 161464,
"Pos" : null,
"WPExt" : null,
"OS" : 0,
"HP" : "(345) 678-7890",
"BTTC" : 0,
"PWD" : null,
"UId" : 627,
"DId" : 0,
"UN" : null,
"CY" : "Salt lake",
"Comp" : null,
"PMC" : 0,
"AEa" : null,
"AnD" : null,
"DOB" : "1\/05\/1979",
"IDel" : false,
"ST" : "UH",
"AD" : "2345 Symonds street",
"Mob" : null,
"WP" : "(234) 324-6576",
"PL" : 0,
"Potcus" : false
},
{
"AT" : null,
"EA" : null,
"AD2" : "",
"OP" : null,
"AdsLst" : [
],
"EMs" : null,
"ND" : {
"MN" : null,
"FN" : "Augustine",
"LN" : "Gomes"
},
"ZP" : "43567",
"CT" : 1,
"PP" : 0,
"cId" : 161466,
"Pos" : null,
"WPExt" : null,
"OS" : 0,
"HP" : "(456) 457-6588",
"BTTC" : 0,
"PWD" : null,
"UId" : 627,
"DId" : 0,
"UN" : null,
"CY" : "test",
"Comp" : null,
"PMC" : 0,
"AEa" : null,
"AnD" : null,
"DOB" : null,
"IDel" : false,
"ST" : "AZ",
"AD" : "2345 test",
"Mob" : null,
"WP" : "(678) 987-0890",
"PL" : 0,
"Potcus" : false
},
{
"AT" : null,
"EA" : null,
"AD2" : "",
"OP" : null,
"AdsLst" : [
],
"EMs" : null,
"ND" : {
"MN" : null,
"FN" : "Jenny",
"LN" : "X"
},
"ZP" : "45678",
"CT" : 1,
"PP" : 0,
"cId" : 161467,
"Pos" : null,
"WPExt" : null,
"OS" : 0,
"HP" : "(435) 644-6545",
"BTTC" : 0,
"PWD" : null,
"UId" : 627,
"DId" : 0,
"UN" : null,
"CY" : "Sallas",
"Comp" : null,
"PMC" : 0,
"AEa" : null,
"AnD" : null,
"DOB" : null,
"IDel" : false,
"ST" : "TX",
"AD" : "2433 Main street",
"Mob" : null,
"WP" : "(657) 656-8798",
"PL" : 0,
"Potcus" : false
},
{
"AT" : null,
"EA" : null,
"AD2" : "",
"OP" : null,
"AdsLst" : [
],
"EMs" : null,
"ND" : {
"MN" : null,
"FN" : "BLVD Cont F1",
"LN" : "Blvd Contact L1"
},
"ZP" : "",
"CT" : 1,
"PP" : 0,
"cId" : 161473,
"Pos" : null,
"WPExt" : null,
"OS" : 0,
"HP" : null,
"BTTC" : 0,
"PWD" : null,
"UId" : 627,
"DId" : 0,
"UN" : null,
"CY" : "",
"Comp" : null,
"PMC" : 0,
"AEa" : null,
"AnD" : null,
"DOB" : null,
"IDel" : false,
"ST" : "",
"AD" : "",
"Mob" : null,
"WP" : null,
"PL" : 0,
"Potcus" : false
},
在此響應中,我只想顯示「FN」,「LN」,「CT」,「PP」,「cId」,「Pos」,「 AT」,‘EA’,‘AD2’這些標籤值....然後是空值只是想顯示‘蘋果’......檢查目標C中的Json響應的空值
誰能幫助我
我的代碼是
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSError *error;
json = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];
NSLog(@"json.... %@",json);
id jsonObject = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingAllowFragments error:nil];
NSLog(@"jsonObject=%@", jsonObject);
NSDictionary *checkArray=[jsonObject valueForKey:@"ND"];
cheDisk=[checkArray valueForKey:@"FN"];
cheDisk1=[checkArray valueForKey:@"LN"];
NSLog(@"FN =%@",cheDisk);
NSLog(@"LN =%@",cheDisk1);
}
犯錯,怎麼樣'如果(對象==無)文本= @ 「蘋果」;'? – trojanfoe
我不確定我明白你想要做什麼? – dreamlax
是...我想顯示「FN」,「LN」,「CT」,「PP」,「cId」,「Pos」,「AT」,「EA」,「AD2」這些標籤值... 。如果null意味着只顯示「蘋果」字符串 – Siva