如何在iPhone SDK中解析JSON对象?

如何在iPhone SDK中解析JSON对象?,iphone,xcode,json,Iphone,Xcode,Json,我需要通过以下方式解析接收到的数据: [ { "IdEmpleado":1, "Nombre":"Cesar", "Edad":"25", "Genero":"M", "IdArea":1 }, { "IdEmpleado":2, &q

我需要通过以下方式解析接收到的数据:

[
  {
     "IdEmpleado":1, 
     "Nombre":"Cesar",
     "Edad":"25",
     "Genero":"M",
     "IdArea":1
  },
  {
     "IdEmpleado":2,
     "Nombre":"Luis",
     "Edad":"30",
     "Genero":"M",
     "IdArea":2
  }
]
我需要获取每个员工的数据,在示例中,2个员工需要每个对象的所有字段,然后将它们转换为员工


我已经使用了JSON并将其传输到NSDICTIONARY,但是我如何将其结构化,以便每个字段都能够传递一个方法来转换对象EMPLOYEE?

您可以使用JSONFramework,您可以在这里找到它


您可以使用JSONFramework,您可以在这里找到它


我已经使用JSON并将其传输到NSDICTIONARY,但是如何将其结构化,以便每个字段都能够传递一个方法来转换对象EMPLOYEE?我已经使用JSON并将其传输到NSDICTIONARY,但是我如何将其结构化,以便每个字段能够传递一个方法来转换对象雇员?我已经使用JSON并将其传输到NSDICTIONARY,但是我如何将其结构化,以便每个字段能够传递一个方法来转换对象雇员?我已经使用JSON并将其传输到NSDICTIONARY,但是我怎样才能使它结构化,使每个字段都能传递一个方法来转换一个对象雇员呢?你需要更清楚你需要什么。您是否试图自动创建一个对象来公开结构化词典的命名属性等?您需要更清楚地了解您需要什么。您是否正在尝试自动创建一个对象,该对象公开结构化词典的命名属性等?
     NSString *userid= [[NSUserDefaults standardUserDefaults]objectForKey:@"Userid"];
        NSString *appurl =[NSString stringWithFormat:@"your link"];
        appurl = [appurl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:appurl]];
        NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse: nil error: nil ];
        NSString  *returnString = [[NSString alloc] initWithData:returnData encoding: NSUTF8StringEncoding];
        NSMutableDictionary *deletdict=[returnString JSONValue];
        if([[deletdict objectForKey:@"success"] isEqualToString:@"False"])
        {
            NSLog(@"Unsuccess...");

        }
        else
        {
            NSLog(@"success...");
        }



AND Post method is this 

    NSString *post =[NSString stringWithFormat:@"AgencyId=STM&UserId=1&Type=1&Date=%@&Time=%@&Coords=%@&Image=h32979`7~U@)01123737373773&SeverityLevel=2",strDateLocal,strDateTime,dict];
    NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
    NSString *postLength = [NSString stringWithFormat:@"%d",[postData length]];
    NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
    [request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://174.94.153.48:7778/TransitApi/IncidentConfirm/"]]];
    [request setHTTPMethod:@"POST"];
    [request setValue:postLength forHTTPHeaderField:@"Content-Length"];
    [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
    [request setHTTPBody:postData];
    NSError *error;
    NSURLResponse *response;
    NSData *urlData=[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
    NSString *str=[[NSString alloc]initWithData:urlData encoding:NSUTF8StringEncoding];

    NSMutableArray *SubLiveArray=[str JSONValue];


download Json framework on this link:::

http://mobile.tutsplus.com/tutorials/iphone/iphone-json-twitter-api


NSString *appurl=[NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/search/json?location=23.041230,72.514346&radius=50000&types=%@&sensor=true&key=AIzaSyAQZ16VzshxGbYdiM8C2RhhwGl3QwVJTB4",_txt_search.text];