Hi, there were quite a few discussions and requests over the last months to add Json support as part of QtCore, and maybe integrating one of the existing parsers.
I was however never really happy with them. Mainly because they all parse into a QVariant(Map), and don't offer any real API to create and modify Json. In addition, I believed that it was possible to create a faster parser, and wanted to have a binary representation for the parsed Json. So I sat down over the last weeks and implemented hacked on something on my own. You can see the current state in our first playground project that Sergio created for me yesterday. You can clone it from ssh://usern...@codereview.qt-project.org:29418/playground/qtbinaryjson.git Things look rather promising, and I consider the code to be mostly feature complete. There's work to be done on the API, and documentation is still completely missing, but most of the other pieces are there. What I have right now: * A binary representation of Json, that can be simply mmap'ed from a file, or copied around. This gives us an extremely cheap way to load and save Json objects in binary form. The binary representation is optimized for fast reading. The binary format is relatively compact and stores the whole object in one blob. * An API consisting of JsonObject, JsonArray and JsonValue that allows for fast and easy iteration and modification of the binary format. The Api still needs some work, and I have to write docs about it. * Conversion between the binary representation and a QVariantMap * Conversion to and from text based Json. The Json parser is a handwritten, recursive parser. It converts Json (utf8 encoded) into the binary representation. I've tried to make it as fast as possible and let it do a minimum amount of allocations. I've benchmarked parsing speed and compared to the qjson (http://qjson.sourceforge.net/). It's around 7 times faster for the test.json file included in the project (the test case used in qjson as well). * It's compact and small. The whole implementation compiles into a 77k shared library at the moment, with very few relocations. There's a bit of work still required to finish it, but I would like to start the discussion about including it into QtCore anyways. I'd also be happy about any feedback. Cheers, Lars _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development