json - SBJson Parse Data on iOS -


i want parse json has structure on ios, sbjson libs can me? much!

{"error":{"username":["the username has been taken."],"email":["the email has been taken."]}}

nsstring *str=@"{\"error\":{\"username\":[\"the username has been taken.\"],\"email\":[\"the email has been taken.\"]}}";  nsdata *data=[str datausingencoding:nsutf8stringencoding];  nsdictionary *json = [nsjsonserialization jsonobjectwithdata: data options: nsjsonreadingmutablecontainers error: nil];  nslog(@"dic %@",json); 

//output

dic {     error =     {         email =         (             "the email has been taken."         );         username =         (             "the username has been taken."         );     }; } 

using sbjson

sbjson *parser = [[sbjson alloc] init]; nsdictionary *results = [str jsonvalue]; 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -