title: how to write json file in ios
body: <p>Here i am reading and writing a json file.</p>
  
  <p>Reading is done correctly but while i am writing a file it doesn't write data in json file.</p>
  
  <p>Here is my code.</p>
  
  <pre><code>//reading Json file....
  NSString *filePath = [[NSBundle mainBundle] pathForResource:@"bookmark" ofType:@"json"];
  
  NSData *content = [[NSData alloc] initWithContentsOfFile:filePath];
  NSArray *bookmarkJson=[NSJSONSerialization JSONObjectWithData:content options:0 error:nil];
  //this contains array's of dictionary....
  NSDictionary *newBookmark=@{@"index":@"1.1.1.1",@"text":@"Header",@"htmlpage":@"page_name"};
  
  //take new array to add data with previous one
  NSMutableArray *temp=[[NSMutableArray alloc]initWithArray:bookmarkJson];
  // add object to new array...
  [temp insertObject:newBookmark atIndex:0];
  
  //now serialize temp data....
  NSData *serialzedData=[NSJSONSerialization dataWithJSONObject:temp options:0 error:nil];
  
  NSString *saveBookmark = [[NSString alloc] initWithBytes:[serialzedData bytes] length:[serialzedData length] encoding:NSUTF8StringEncoding];
  
  //now i write json file.....    
  [saveBookmark writeToFile:@"bookmark.json" atomically:YES encoding:NSUTF8StringEncoding error:nil];
  </code></pre>
  
  <p>In "saveBookmark" (NSString)object i got correct file format but in bookmark.json file i didn't got any new values.</p>
  
  <p>Please help me with this......</p>