21
2011
JSON in ios 5
Before ios 5, we have to use third party JSON library like SBJSON or TouchJson to deal with JSON data. Today, iOS 5 has built-in APIs in the Foundation Framework which is called the NSJSONSerialization to make it easy to read and write JSON. Click here for reference. Below is an example of how to read JSON data into NSArray, NSDictionary and NSString. NSString* str= @"{\"name\":\"cayden\",\"hobby\":[{\"0\":\"programming\"}, {\"1\":\"gym\"}]}"; NSData* data=[str dataUsingEncoding:NSASCIIStringEncoding]; NSError* error; NSDictionary* json [...]
Ads
Facebook Page
Categories
- Apache (1)
- Apps (2)
- Blog (19)
- IOS (20)
- IOS Library (5)
- iPhone Tutorial (17)
- Javascript (1)
- Node.js (1)
- Twitter (1)


An article by