0

This is my json format printed in output log my 1st doubt is how i create separate class for mystatus object in json object and with mystatus object i need to check whether the entered username and password is correct or not, if valid username means it should return value as "s"

This my response

{"login_response":[{"phone":"000000000","status":"Login Successfull",","**mystatus**":"S","mpin":"",","card_store_flag":"0"}]}
Dhruv
  • 2,153
  • 3
  • 21
  • 45
Anand ios
  • 57
  • 1
  • 12

2 Answers2

-1

please try this.....

NSData *MyData = [jsonResponce dataUsingEncoding:NSUTF8StringEncoding];
NSError *error;
NSString *strString = [NSJSONSerialization JSONObjectWithData:MyData options:NSJSONReadingMutableContainers error:&error];
Rohit
  • 577
  • 1
  • 3
  • 13
-1
NSURL *myURL = [[NSURL alloc]initWithString:@"http://yourwebservice link with json"];
NSData *myData = [[NSData alloc]initWithContentsOfURL:myURL];
if (myData == nil)
{
    NSLog(@"NO INTERNET");
}
else
{
    NSLog(@"INTERNET EXIST");
    NSArray *jsonArray = [NSJSONSerialization JSONObjectWithData:myData options:kNilOptions error:nil];
    for (id element in jsonArray)
    {
        NSString *durum = [element objectForKey:@"yourJsonHeader"];
        if([yourJsonHeader isEqualToString:@"1"])
        {


        }

    }

}
Gökhan Çokkeçeci
  • 1,388
  • 3
  • 16
  • 37