2012-03-05 11 views
0

iphoneの 'JSON'パーサーを使用してリソースフォルダに保存されたテキストファイル '.txt'を解析する方法はありますか? ご意見をお待ちしております。 ありがとうNeha Mehta。iphoneのjsonを使用してテキストファイルを解析する

+0

ようこそスタックオーバーフロー。 [How to Ask](http://stackoverflow.com/questions/how-to-ask)、[何を試しましたか?](http://mattgemmell.com/2008/12/08/what-have 「〜を試してみよう」、「[スマートウェイに質問する方法]」(http://catb.org/esr/faqs/smart-questions.html)を参照してください。 –

答えて

2

テキストファイルを読み込んでJSON..simpleを初期化します。

NSString *textPAth = [[NSBundle mainBundle] pathForResource:@"content" ofType:@"txt"]; 

    NSError *error; 
    NSString *content = [NSString stringWithContentsOfFile:textPAth encoding:NSUTF8StringEncoding error:&error]; //error checking omitted 

    SBJsonParser *parser = [[SBJsonParser alloc] init]; 

     NSDictionary *json = [parser objectWithString: content];  
関連する問題