I think is one of the most common questions for an iOS developer:
Which one is the best JSON library?
I think the best test that we can do is a quick benchmark, even if I think that it’s not only the speed that makes a library better than others.
So, today I decided to do a quick performance project to check which of the following libraries is the best one in terms of speed:
- SBJson - Previously known as json-framework
- JSONKit
- NextiveJSON
- TouchJSON
- NSJSONSerialization - Public API since iOS5
To do this quick test (at the moment I’m only deserializing the JSON file) I create a project with all the libraries.
I also created 3 different kind of JSON file:
- A JSON file from public Twitter timeline
- A random JSON file generated with 1000 records with variable objects *
- A classic JSON file with 100 records with 2 objects *
To generate the files marked with * I used this nice online tool: json-generator.appspot.com