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

前端 未结 2 1722
攒了一身酷
攒了一身酷 2020-12-10 17:19

Our app must display a big chunk of data with minimal remote http requests, so we have added an endpoint to our backend that provides all the necessary data as a single json

相关标签:
2条回答
  • 2020-12-10 18:06

    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/

    0 讨论(0)
  • 2020-12-10 18:07

    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.

    0 讨论(0)
提交回复
热议问题