title: Create a JsonString in iOS
body: <p>I am new in iOS. I created a <code>JSON NSDictionary</code> like this: </p>
  
  <pre><code>NSArray *keys = [NSArray arrayWithObjects:@"User", @"Password", nil];
  NSArray *objects = [NSArray arrayWithObjects:@"Ali", @"2020", nil];
  NSDictionary *jsonDictionary = [NSDictionary dictionaryWithObjects:objects forKeys:keys];
  </code></pre>
  
  <p>And then I could convert it to <code>NSString</code> via two mechanisms:</p>
  
  <p>1)</p>
  
  <pre><code>NSError *error; 
  NSData *jsonData = [NSJSONSerialization dataWithJSONObject:jsonDictionary options:0 error:&amp;error];
  
  NSString *jsonString = nil;
  if (! jsonData) {
       NSLog(@"Got an error: %@", error);
  } else {
       jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
  }
  </code></pre>
  
  <p>2)</p>
  
  <pre><code>NSString *jsonString = [jsonDictionary JSONRepresentation];
  </code></pre>
  
  <p>In the second way I get this <code>warning</code> : </p>
  
  <pre><code>Instance method '-JSONRepresentation' not found (return type defaults to 'id')
  </code></pre>
  
  <p>But when I run the project, both of the mechanisms works fine:</p>
  
  <pre><code>NSLog(@"Val of json parse obj is %@",jsonString); 
  </code></pre>
  
  <p>Do you know how can I remove the warning in the second way? </p>
  
  <p><strong>My main goal is <code>POST</code> this json String to an external database using RESTful Web Service.
  Basically which way is better considering my main goal?</strong></p>