title: Parsing JSON response in Objective-C
body: <p>I am working on an iOS json client for a php webservice and for some reason I'm having problems parsing a fairly simple json response from the server. What do I need to do?</p>
  
  <p><strong>Edit</strong>
  The problem isn't the parsing so it must be the jsonString I'm sending the webservice.</p>
  
  <p>Basically I need to send this<BR/></p>
  
  <p>POST values<BR/>
  app = mark<BR/>
  data = { "01,E1,AT333AT333,9053839719,2012-08-28 14:35:58,2012-08-28 14:35:58,43.154650,-79.3877390,1000,YS3DD55H812035739,1000000,3434" }</p>
  
  <p>The current code is printing null for both strings.</p>
  
  <p>Here's my method that handles the call to the webservice.</p>
  
  <pre><code>- (IBAction)submitMessage
  {
      NSString* apps =@"mark";
      NSString* data = @"01,E1,AT333AT333,9053839719,2012-08-28 14:35:58,2012-08-28 14:35:58,43.154650,-79.3877390,1000,YS3DD55H812035739,1000000,3434";
      NSDictionary* jsonDictionary=[NSDictionary dictionaryWithObject: data forKey:@"data"];
      NSString* jsonString = [jsonDictionary JSONRepresentation];
      self.outPut.text=jsonString;
      NSLog(@"Made it");
      NSURL *url = [NSURL URLWithString:@"http://secure.g4apps.com/g4webservices.php"];
      AFHTTPClient *httpClient=[[AFHTTPClient alloc] initWithBaseURL:url];
      NSDictionary *params =[NSDictionary dictionaryWithObjectsAndKeys:
                             apps,@"app",
                             jsonString,@"smpdata",nil];
  
      NSMutableURLRequest *request = [httpClient requestWithMethod:@"POST" path:@"g4webservices.php" parameters:params];
  
      AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request
          success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
              NSLog(@"Response: %@ %@", [JSON valueForKeyPath:@"Status"], [JSON valueForKeyPath:@"Data"]);
              self.outPut2.text = [NSString stringWithFormat:@"response: %@ %@",[JSON valueForKeyPath:@"Status"], [JSON valueForKeyPath:@"Data"]];    }
                          failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error,id JSON){
                                           NSLog(@"[Error]: %@", error);
      }
  ];
  
      [operation start];
  
  
  }
  </code></pre>
  
  <p>Here's a sample json response.</p>
  
  <pre><code>{
  
  "Status":"11",
  "Data":["AT333AT333,43.1547986,-79.3884892",
  "BT343BT343,43.1547986,-79.3884892"]
  
  }
  </code></pre>