2012-09-22 44 views
-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

你用'NSLog'試過了嗎? – Maulik

回答

0

假設你有一個文件捆綁(因爲它不清楚問題),你可以閱讀用下面的代碼:

NSString * path = [[NSBundle mainBundle] pathForResource:@"YOU_FILE_NAME" ofType:@"txt"]; 

NSString *jsonString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; 

然後打印用它來安慰:

NSLog(@"%@",jsonString); 
+0

thanq先生,它真的幫助完整........ – Rajesh

+0

如果它適合你,我的榮幸.. –

+0

如何顯示它在一張桌子....? – Rajesh

0

解析使用SBJson,然後它的NSLog

 NSString *replycode=[jsonResponse objectForKey:@"replyCode"]; 
     NSLog(@"Reply = %@",replycode); 
相關問題