how to do json parsing in iphone

后端 未结 2 1296
天命终不由人
天命终不由人 2021-01-03 09:16

i am using json parsing in my application and this is my json data is as follow :

{\"response\" : {\"success\":false,\"error\": {\"code\":7,\"description\":\"You a

相关标签:
2条回答
  • 2021-01-03 09:38

    We're using CJSONDeserializer (TouchJSON library) in the iPhone app being developed at work.

    Just use the following method:

    NSDictionary * dictionary = [[CJSONDeserializer deserializer] deserializeAsDictionary:data error:&error];
    

    where data is of type NSData *. It will convert the JSON string into a dictionary so you could get the value of description as follows:

    [[[dictionary objectForKey:@"response"] objectForKey:@"error"] objectForKey:@"description"];
    
    0 讨论(0)
  • 2021-01-03 09:45

    Check the blog post with sample code and step by step parsing of JSON.

    http://www.xprogress.com/post-44-how-to-parse-json-files-on-iphone-in-objective-c-into-nsarray-and-nsdictionary/

    http://pessoal.org/blog/2008/12/12/iphone-sdk-parsing-json-data/

    http://mobileorchard.com/tutorial-json-over-http-on-the-iphone/

    0 讨论(0)
提交回复
热议问题