companies:[
{
"name":"APPLE",
"id":"1",
Departments:[
{
"name":"Designing",
"id":"1.1",
Employees:[
{
"name":"Ramesh",
"id":"1.1.1",
"salary":"4lakhs"
},
{
"name":"Suresh",
"id":"1.1.2",
"salary":"4lakhs"
},
{
"name":"Mukesh",
"id":"1.1.3",
"salary":"4lakhs"
}
]
},
{
"name":"Developing",
"id":"1.2",
Employees:[
{
"name":"Ram",
"id":"1.2.1",
"salary":"4lakhs"
},
{
"name":"Sam",
"id":"1.2.2",
"salary":"4lakhs"
},
{
"name":"Dham",
"id":"1.2.3",
"salary":"4lakhs"
}
]
},
{
"name":"Testing",
"id":"1.3",
Employees:[
{
"name":"Rocky",
"id":"1.3.1",
"salary":"4lakhs"
},
{
"name":"Jockey",
"id":"1.3.2",
"salary":"4lakhs"
},
{
"name":"Sockey",
"id":"1.3.3",
"salary":"4lakhs"
}
]
}
]
},
{
"name":"GOOGLE",
"id":"2",
Departments:[
{
"name":"Designing",
"id":"2.1",
Employees:[
{
"name":"Ramesh",
"id":"2.1.1",
"salary":"4lakhs"
},
{
"name":"Suresh",
"id":"2.1.2",
"salary":"4lakhs"
},
{
"name":"Mukesh",
"id":"2.1.3",
"salary":"4lakhs"
}
]
},
{
"name":"Developing",
"id":"2.2",
Employees:[
{
"name":"Ram",
"id":"2.2.1",
"salary":"4lakhs"
},
{
"name":"Sam",
"id":"2.2.2",
"salary":"4lakhs"
},
{
"name":"Dham",
"id":"2.2.3",
"salary":"4lakhs"
}
]
},
{
"name":"Testing",
"id":"2.3",
Employees:[
{
"name":"Rocky",
"id":"2.3.1",
"salary":"4lakhs"
},
{
"name":"Jockey",
"id":"2.3.2",
"salary":"4lakhs"
},
{
"name":"Sockey",
"id":"2.3.3",
"salary":"4lakhs"
}
]
}
]
}
]
質問する
84 次
2 に答える
0
バンドルにファイルがあると仮定すると(質問からは明らかではないため)、次のコードでファイルを読み取ることができます。
NSString * path = [[NSBundle mainBundle] pathForResource:@"YOU_FILE_NAME" ofType:@"txt"];
NSString *jsonString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
次に、次を使用してコンソールに出力します。
NSLog(@"%@",jsonString);
于 2012-09-22T10:48:55.960 に答える
0
SBJsonを使用して解析し、それを NSLog します
NSString *replycode=[jsonResponse objectForKey:@"replyCode"];
NSLog(@"Reply = %@",replycode);
于 2012-09-22T10:49:22.800 に答える