# JSONKit
JSONKit is dual licensed under either the terms of the BSD License, or alternatively under the terms of the Apache License, Version 2.0.<br />
Copyright © 2011, John Engelhart.
### A Very High Performance Objective-C JSON Library
**UPDATE:** (2011/12/18) The benchmarks below were performed before Apples [`NSJSONSerialization`][NSJSONSerialization] was available (as of Mac OS X 10.7 and iOS 5). The obvious question is: Which is faster, [`NSJSONSerialization`][NSJSONSerialization] or JSONKit? According to [this site](http://www.bonto.ch/blog/2011/12/08/json-libraries-for-ios-comparison-updated/), JSONKit is faster than [`NSJSONSerialization`][NSJSONSerialization]. Some quick "back of the envelope" calculations using the numbers reported, JSONKit appears to be approximately 25% to 40% faster than [`NSJSONSerialization`][NSJSONSerialization], which is pretty significant.
Parsing | Serializing
:---------:|:-------------:
<img src="http://chart.googleapis.com/chart?chf=a,s,000000%7Cb0,lg,0,6589C760,0,6589C7B4,1%7Cbg,lg,90,EFEFEF,0,F8F8F8,1&chxl=0:%7CTouchJSON%7CXML+.plist%7Cjson-framework%7CYAJL-ObjC%7Cgzip+JSONKit%7CBinary+.plist%7CJSONKit%7C2:%7CTime+to+Deserialize+in+%C2%B5sec&chxp=2,40&chxr=0,0,5%7C1,0,3250&chxs=0,676767,11.5,1,lt,676767&chxt=y,x,x&chbh=a,5,4&chs=350x185&cht=bhs&chco=6589C783&chds=0,3250&chd=t:410.517,510.262,539.614,1351.257,1683.346,1747.953,2955.881&chg=-1,0,1,3&chm=N+*s*+%C2%B5s,676767,0,0:5,10.5%7CN+*s*+%C2%B5s,3d3d3d,0,6,10.5,,r:-5:1&chem=y;s=text_outline;d=666,10.5,l,fff,_,Decompress+%2b+Parse+is+just;ds=0;dp=2;py=0;of=58,7%7Cy;s=text_outline;d=666,10.5,l,fff,_,5.6%25+slower+than+Binary+.plist%21;ds=0;dp=2;py=0;of=53,-5" width="350" height="185" alt="Deserialize from JSON" /> | <img src="http://chart.googleapis.com/chart?chf=a,s,000000%7Cb0,lg,0,699E7260,0,699E72B4,1%7Cbg,lg,90,EFEFEF,0,F8F8F8,1&chxl=0:%7CTouchJSON%7CYAJL-ObjC%7CXML+.plist%7Cjson-framework%7CBinary+.plist%7Cgzip+JSONKit%7CJSONKit%7C2:%7CTime+to+Serialize+in+%C2%B5sec&chxp=2,40&chxr=0,0,5%7C1,0,3250&chxs=0,676767,11.5,1,lt,676767&chxt=y,x,x&chbh=a,5,4&chs=350x175&cht=bhs&chco=699E7284&chds=0,3250&chd=t:96.387,466.947,626.153,1028.432,1945.511,2156.978,3051.976&chg=-1,0,1,3&chm=N+*s*+%C2%B5s,676767,0,0:5,10.5%7CN+*s*+%C2%B5s,4d4d4d,0,6,10.5,,r:-5:1&chem=y;s=text_outline;d=666,10.5,l,fff,_,Serialize+%2b+Compress+is+34%25;ds=0;dp=1;py=0;of=51,7%7Cy;s=text_outline;d=666,10.5,l,fff,_,faster+than+Binary+.plist%21;ds=0;dp=1;py=0;of=62,-5" width="350" height="185" alt="Serialize to JSON" />
*23% Faster than Binary* <code><em>.plist</em></code>* !* | *549% Faster than Binary* <code><em>.plist</em></code>* !*
* Benchmarking was performed on a MacBook Pro with a 2.66GHz Core 2.
* All JSON libraries were compiled with `gcc-4.2 -DNS_BLOCK_ASSERTIONS -O3 -arch x86_64`.
* Timing results are the average of 1,000 iterations of the user + system time reported by [`getrusage`][getrusage].
* The JSON used was [`twitter_public_timeline.json`](https://github.com/samsoffes/json-benchmarks/blob/master/Resources/twitter_public_timeline.json) from [samsoffes / json-benchmarks](https://github.com/samsoffes/json-benchmarks).
* Since the `.plist` format does not support serializing [`NSNull`][NSNull], the `null` values in the original JSON were changed to `"null"`.
* The [experimental](https://github.com/johnezang/JSONKit/tree/experimental) branch contains the `gzip` compression changes.
* JSONKit automagically links to `libz.dylib` on the fly at run time– no manual linking required.
* Parsing / deserializing will automagically decompress a buffer if it detects a `gzip` signature header.
* You can compress / `gzip` the serialized JSON by passing `JKSerializeOptionCompress` to `-JSONDataWithOptions:error:`.
[JSON versus PLIST, the Ultimate Showdown](http://www.cocoanetics.com/2011/03/json-versus-plist-the-ultimate-showdown/) benchmarks the common JSON libraries and compares them to Apples `.plist` format.
***
JavaScript Object Notation, or [JSON][], is a lightweight, text-based, serialization format for structured data that is used by many web-based services and API's. It is defined by [RFC 4627][].
JSON provides the following primitive types:
* `null`
* Boolean `true` and `false`
* Number
* String
* Array
* Object (a.k.a. Associative Arrays, Key / Value Hash Tables, Maps, Dictionaries, etc.)
These primitive types are mapped to the following Objective-C Foundation classes:
JSON | Objective-C
-------------------|-------------
`null` | [`NSNull`][NSNull]
`true` and `false` | [`NSNumber`][NSNumber]
Number | [`NSNumber`][NSNumber]
String | [`NSString`][NSString]
Array | [`NSArray`][NSArray]
Object | [`NSDictionary`][NSDictionary]
JSONKit uses Core Foundation internally, and it is assumed that Core Foundation ≡ Foundation for every equivalent base type, i.e. [`CFString`][CFString] ≡ [`NSString`][NSString].
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119][].
### JSON To Objective-C Primitive Mapping Details
* The [JSON specification][RFC 4627] is somewhat ambiguous about the details and requirements when it comes to Unicode, and it does not specify how Unicode issues and errors should be handled. Most of the ambiguity stems from the interpretation and scope [RFC 4627][] Section 3, Encoding: `JSON text SHALL be encoded in Unicode.` It is the authors opinion and interpretation that the language of [RFC 4627][] requires that a JSON implementation MUST follow the requirements specified in the [Unicode Standard][], and in particular the [Conformance][Unicode Standard - Conformance] chapter of the [Unicode Standard][], which specifies requirements related to handling, interpreting, and manipulating Unicode text.
The default behavior for JSONKit is strict [RFC 4627][] conformance. It is the authors opinion and interpretation that [RFC 4627][] requires JSON to be encoded in Unicode, and therefore JSON that is not legal Unicode as defined by the [Unicode Standard][] is invalid JSON. Therefore, JSONKit will not accept JSON that contains ill-formed Unicode. The default, strict behavior implies that the `JKParseOptionLooseUnicode` option is not enabled.
When the `JKParseOptionLooseUnicode` option is enabled, JSONKit follows the specifications and recommendations given in [The Unicode 6.0 standard, Chapter 3 - Conformance][Unicode Standard - Conformance], section 3.9 *Unicode Encoding Forms*. As a general rule of thumb, the Unicode code point `U+FFFD` is substituted for any ill-formed Unicode encountered. JSONKit attempts to follow the recommended *Best Practice for Using U+FFFD*: ***Replace each maximal subpart of an ill-formed subsequence by a single U+FFFD.***
The following Unicode code points are treated as ill-formed Unicode, and if `JKParseOptionLooseUnicode` is enabled, cause `U+FFFD` to be substituted in their place:
`U+0000`.<br>
`U+D800` thru `U+DFFF`, inclusive.<br>
`U+FDD0` thru `U+FDEF`, inclusive.<br>
<code>U+<i>n</i>FFFE</code> and <code>U+<i>n</i>FFFF</code>, where *n* is from `0x0` to `0x10`
The code points `U+FDD0` thru `U+FDEF`, <code>U+<i>n</i>FFFE</code>, and <code>U+<i>n</i>FFFF</code> (where *n* is from `0x0` to `0x10`), are defined as ***Noncharacters*** by the Unicode standard and "should never be interchanged".
An exception is made for the code point `U+0000`, which is legal Unicode. The reason for this is that this particular code point is used by C string handling code to specify the end of the string, and any such string handling code will incorrectly stop processing a string at the point where `U+0000` occurs. Although reasonable people may have different opinions on this point, it is the authors considered opinio
没有合适的资源?快使用搜索试试~ 我知道了~
xmpp仿qq完整iOS项目
共2273个文件
h:1350个
m:456个
png:247个
5星 · 超过95%的资源 需积分: 10 58 下载量 144 浏览量
2015-09-02
11:51:54
上传
评论 3
收藏 6.78MB ZIP 举报
温馨提示
代码很详细,很新。完整应用xmpp仿qq,亲测包含后端xmpp服务器在内可用。需要的同学可以自己下载再改后端xmpp主机ip即可直接使用
资源推荐
资源详情
资源评论
收起资源包目录
xmpp仿qq完整iOS项目 (2273个子文件)
libopencore-amrnb.a 2.59MB
libidn.a 1.57MB
libopencore-amrnb.a 1.1MB
libopencore-amrwb.a 962KB
libopencore-amrwb.a 408KB
contents 3KB
contents 2KB
contents 2KB
contents 990B
contents 930B
contents 817B
contents 723B
RACSignalProvider.d 222B
RACCompoundDisposableProvider.d 190B
.DS_Store 8KB
.DS_Store 8KB
elements 107KB
elements 44KB
elements 35KB
elements 31KB
blueprint.gif 18KB
.gitignore 108B
GCDAsyncSocket.h 51KB
GCDAsyncUdpSocket.h 44KB
ASIHTTPRequest.h 44KB
XMPPStream.h 41KB
RACSignal+Operations.h 32KB
RACmetamacros.h 30KB
AFURLSessionManager.h 30KB
AsyncSocket.h 29KB
DDLog.h 24KB
NINetworkImageView.h 23KB
AFURLRequestSerialization.h 22KB
Pods-environment.h 21KB
AFHTTPRequestOperationManager.h 19KB
NimbusModels.h 19KB
idn-int.h 18KB
NIAttributedLabel.h 18KB
AFURLConnectionOperation.h 17KB
MBProgressHUD.h 17KB
NICSSRuleset.h 16KB
XMPPCapabilities.h 15KB
NIDataStructures.h 15KB
AFHTTPSessionManager.h 15KB
XMPPCoreDataStorageProtected.h 14KB
AsyncUdpSocket.h 14KB
NIActions.h 14KB
XMPPRoster.h 13KB
RACStream.h 13KB
UIButton+WebCache.h 13KB
XMPPPubSub.h 13KB
DDFileLogger.h 12KB
NimbusCSS.h 12KB
AFURLResponseSerialization.h 12KB
JSONKit.h 11KB
NIFoundationMethods.h 11KB
NIFormCellCatalog.h 11KB
NIPagingScrollView.h 11KB
SDWebImageManager.h 11KB
XMPPRoom.h 10KB
NIInMemoryCache.h 10KB
UIImageView+WebCache.h 10KB
NIInterapp.h 10KB
RACSignal.h 9KB
NICellFactory.h 9KB
UIButton+AFNetworking.h 9KB
DDXMLPrivate.h 9KB
XMPPPrivacy.h 9KB
XMPPLogging.h 9KB
NILauncherView.h 9KB
NIMutableTableViewModel.h 8KB
NIRadioGroup.h 8KB
NimbusAttributedLabel.h 8KB
stringprep.h 8KB
NITableViewModel.h 8KB
DDXML.h 8KB
XMPPReconnect.h 8KB
AFNetworkReachabilityManager.h 8KB
XMPPRoomHybridStorage.h 8KB
SDImageCache.h 8KB
NICollectionViewCellFactory.h 8KB
NISnapshotRotation.h 7KB
UIImageView+AFNetworking.h 7KB
NIDOM.h 7KB
RACScheduler.h 7KB
SDWebImageDownloader.h 7KB
XMPPCoreDataStorage.h 7KB
NICollectionViewModel.h 6KB
RACSequence.h 6KB
DDTTYLogger.h 6KB
NIToolbarPhotoViewController.h 6KB
NIDebuggingTools.h 6KB
UIWebView+AFNetworking.h 6KB
NIMutableCollectionViewModel.h 6KB
NISDKAvailability.h 6KB
NIPhotoScrubberView.h 6KB
NIWebController.h 5KB
NICommonMetrics.h 5KB
RACTuple.h 5KB
XMPPIDTracker.h 5KB
共 2273 条
- 1
- 2
- 3
- 4
- 5
- 6
- 23
qq_15614879
- 粉丝: 1
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页