Converting an NSArray of Dictionaries to JSON array in iOS

后端 未结 8 1165
逝去的感伤
逝去的感伤 2020-12-13 08:09

I need to send an NSArray to the server in the JSON array format. How can I convert it to JSON. This is a sample of my NSArray

8条回答
  •  我在风中等你
    2020-12-13 08:43

    #import 
    
    NSArray *array = // Your array here.
    NSString *json = [array JSONString];
    
    NSLog(@"%@", json);
    

    JSONKit performs significantly better than SBJson and others in my own and the author's benchmarks.

提交回复
热议问题