jsonkit

JSONKit benchmarks

≯℡__Kan透↙ 提交于 2020-01-22 10:48:18
问题 I pulled the code from http://www.bonto.ch/blog/2011/12/08/json-libraries-for-ios-comparison-updated/ and tested it on my local machine. I was surprised by the results and NSJSonSerialization gave much better performance than JSONKit . Has NSJSonSerialization really overtaken JSONKit in terms of speed or did I do something wrong? twitter_timeline.json repeat.json random.json 回答1: You have not done anything wrong. Things have changed in iOS 6. Apple have greatly improved the performance of

JSONKit benchmarks

ⅰ亾dé卋堺 提交于 2020-01-22 10:46:07
问题 I pulled the code from http://www.bonto.ch/blog/2011/12/08/json-libraries-for-ios-comparison-updated/ and tested it on my local machine. I was surprised by the results and NSJSonSerialization gave much better performance than JSONKit . Has NSJSonSerialization really overtaken JSONKit in terms of speed or did I do something wrong? twitter_timeline.json repeat.json random.json 回答1: You have not done anything wrong. Things have changed in iOS 6. Apple have greatly improved the performance of

is there an example of AFHTTPClient posting json with AFNetworking?

[亡魂溺海] 提交于 2019-12-31 21:42:12
问题 Looking for an example of how to post json with AFHTTPClient . I see that there is a postPath method which takes an NSDictionary and the AFJSONEncode method returns an NSData . Is there an easy way to serialize an object to NSDictionary , or is there an easier way using jsonkit? I just need to post the object as json to a REST API. UPDATE: So I tried passing a dictionary over but it seems to break on serializing a nested array. For example, if I have an object: Post* p = [[Post alloc] init];

How do I JSON serialize an NSDate Dictionary in JSONKit

有些话、适合烂在心里 提交于 2019-12-21 08:22:34
问题 I tried this using Jsonkit and Apple's JSON serializer with no luck. It keeps breaking on the geo property, which is an nsarray of NSNumbers. Post* p = [[Post alloc] init]; p.uname = @"mike"; p.likes =[NSNumber numberWithInt:1]; p.geo = [[NSArray alloc] initWithObjects:[NSNumber numberWithFloat:37.78583], [NSNumber numberWithFloat:-122.406417], nil ]; p.place = @"New York City"; p.caption = @"A test caption"; p.date = [NSDate date]; NSError* error = nil; NSString* stuff = [[p getDictionary]

How do I JSON serialize an NSDate Dictionary in JSONKit

馋奶兔 提交于 2019-12-21 08:22:24
问题 I tried this using Jsonkit and Apple's JSON serializer with no luck. It keeps breaking on the geo property, which is an nsarray of NSNumbers. Post* p = [[Post alloc] init]; p.uname = @"mike"; p.likes =[NSNumber numberWithInt:1]; p.geo = [[NSArray alloc] initWithObjects:[NSNumber numberWithFloat:37.78583], [NSNumber numberWithFloat:-122.406417], nil ]; p.place = @"New York City"; p.caption = @"A test caption"; p.date = [NSDate date]; NSError* error = nil; NSString* stuff = [[p getDictionary]

iOS: Serialize/Deserialize complex JSON generically from NSObject class

若如初见. 提交于 2019-12-17 04:34:19
问题 Anyone have idea how to serialize nested JSON based on NSObject class? There is a discussion to serialize simple JSON here , but it is not generic enough to cater complex nested JSON. Imagine this is the result of JSON: { "accounting" : [{ "firstName" : "John", "lastName" : "Doe", "age" : 23 }, { "firstName" : "Mary", "lastName" : "Smith", "age" : 32 } ], "sales" : [{ "firstName" : "Sally", "lastName" : "Green", "age" : 27 }, { "firstName" : "Jim", "lastName" : "Galley", "age" : 41 } ]} From

JSONKit: how to keep order of JSON dictionary keys

杀马特。学长 韩版系。学妹 提交于 2019-12-12 04:35:49
问题 I've some JSON String that represents a Map (Dictionary) from the server. I need to draw this map as it is @ my iPhone app. I am using JSONKit and it seems that it uses Hashing function to insert keys into its internal JKDictionary.... So should I send a priority number to order the keys? Or there is some way to make JSONKit to preserve keys ordering of the server JSON data? 回答1: You can choose to add a order property to your dictionary. And sort your keys using that property. Then you can

im getting a warning using objectFromJSONData

妖精的绣舞 提交于 2019-12-12 03:09:57
问题 my objective C app compiles successfully, but i get an Xcode warning: Instance method '-objectFromJSONData' not found (return type defaults to 'id') on this line: NSDictionary *userInfo = [data objectFromJSONData]; How can i get rid of that warning? 回答1: When you make a custom class or use a class built outside of apple, you need to import the headers for the framework or class you are using. This allows the compiler to cross check return types and so forth. When you attempt to send valid

ShareKit Compile Issue - JSONKit not found

我怕爱的太早我们不能终老 提交于 2019-12-11 07:55:00
问题 I have followed the following instructions in order to setup and configure ShareKit: https://github.com/ShareKit/ShareKit/wiki/Installing-sharekit When trying to compile my app, I now get the following error: clang: error: no such file or directory: '/app_root_path/Submodules/ShareKit/Classes/ShareKit/Core/Helpers/../../Submodules/JSONKit/Submodules/ShareKit/Submodules/JSONKit/JSONKit.m' clang: error: no input files Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault

JSONKit: changing and serializing JSON attribute's value

爱⌒轻易说出口 提交于 2019-12-11 05:13:27
问题 I am using JSONKit to parse JSON string into NSDictionary: NSDictionary *deserializedData = [jsonString objectFromJSONString]; My question is: how can I change the dictionary values and get a changed JSON String? I've tried to change the dictionary values: [deserializedData setObject:[NSNumber numberWithInt:iRatings] forKey:@"ratings"]; But the app crashes in that line. What am I doing wrong? Thanks in advance! 回答1: While the other answers are correct, what you really want in this case is: