What's the most efficient way of converting a 10 MB JSON response into an NSDictionary?

亡梦爱人 提交于 2019-11-28 11:26:58

Take a look at JSONKit. It's very fast, and if your JSON has a lot of keys and values that repeat themselves (as is common), its "recently instantiated object cache" will dramatically cut down on the amount of memory used for the "final" NSDictionary.

While JSONKit is faster than YAJL, YAJL supports parsing of the stream. You should be able to wire it up with ASIHTTPRequest to parse the JSON while it's downloading it. Check out the section labeled "Document style parsing as data becomes available" here:

http://gabriel.github.com/yajl-objc/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!