-5
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"
     }
     ]
     }
     ]
     }
     ]
4

2 回答 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 回答