nsjsonserialization in ios5?

后端 未结 6 1234
一个人的身影
一个人的身影 2021-02-02 15:09

I have been reading that there is a now library in ios 5 that allows you to serialize & deserialize JSON data. I can\'t for the life of me find examples or the framework in

相关标签:
6条回答
  • 2021-02-02 15:41

    NSJSONSerialization is now public in iOS 5, and there's an example of its use in the Tweeting sample app.

    0 讨论(0)
  • 2021-02-02 15:42

       Now iOS5 itself has the ability to serialize and de-serialize the json objects,
    it will manage all the process behind the scene, and you will be getting easily
    customizable foundation objects (NSArray,NSDictionary,NSString...)
    Based on your flavor you represented.
        As brainjam suggest This is the good tutorial to begin with. Hope your fingers can play around with json objects easily.

    0 讨论(0)
  • 2021-02-02 15:51

    Using following simple code you can convert web data into JSON .

    In this code "webData" is the data you get when you hit web service.

    NSError *jsonParsingError = nil;
    NSArray *result=[NSJSONSerialization JSONObjectWithData:webData options:0 error:&jsonParsingError]; 
    
    0 讨论(0)
  • 2021-02-02 16:02

    It is actually part of the Foundation framework, been trying to use it since last night and for the purpose of actually serializing a dictionary to a JSON representation it works quite fine. Sadly I've not tested it the other way around. Trust me the doc is there and it is no private API, sadly as you observed there are no examples.

    0 讨论(0)
  • 2021-02-02 16:03

    I stumbled across iOS5 JSON support in this tutorial, which is part of an excellent series of iOS5 tutorials.

    0 讨论(0)
  • 2021-02-02 16:05

    I'm using it and it's quite simple, just import the library:

    #import <Foundation/NSJSONSerialization.h> 
    

    and begin to use it.

    Here there's a small but good tutorial: http://pragprog.com/magazines/2011-11/inside-ios-

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