json array string covvertion to nsmutable array

Posted by sudheer on Stack Overflow See other posts from Stack Overflow or by sudheer
Published on 2013-10-24T09:52:34Z Indexed on 2013/10/24 9:53 UTC
Read the original article Hit count: 197

Filed under:
|
|

I am getting Json response from server.

       type = 2;
      "daysofWeek" = "(\n    Mon,\n    Tue\n)";
       serviceType = 2;
       startDate = "2013-10-28";

In above format daysofWeek is Array string. I am trying to convert into NAMutableArray as

  NSString *weekDaysStr=[valueDict objectForKey:@"recrWeek_daysofWeek"];
  NSMutableArray *weekDays=[[NSMutableArray alloc] initWithArray:[weekDaysStr componentsSeparatedByString:@","]];

But when i log this array i shownig as

     ("\n    Mon",
      "\n    Tue\n"
     )

How to remove those extra words from array.

I have check each values to week day.

               NSString *day=@"Mon";
               if([day isEQualToString:[weekDays objectAtIndex:0]){

                }

At that time its giving false condtion.Help me on this problem

© Stack Overflow or respective owner

Related posts about ios

Related posts about JSON