[Development] Json support for QtCore
Sivan Greenberg
sivan at omniqueue.com
Sun Dec 11 10:39:06 CET 2011
Hi Lars!
On Sat, Dec 10, 2011 at 11:32 PM, <lars.knoll at nokia.com> wrote:
> 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.
There were also discussions and even a couple of bug report about
adding "native" (a'la making Json first class citizen) support to QML
as well (I guess this means adding it to the QDeclerativeContext
engine?) , in favor of having one implementation that'd be standard
and fast - https://bugreports.qt.nokia.com/browse/QTBUG-12117 .
>
> 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.
>
I wonder if the QML implementation in the bug report would suffer from
the same (or perhaps worse?) performance issues?
> 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://username@codereview.qt-project.org:29418/playground/qtbinaryjson.git
>
So, could be bind this to have an QML "native" JSON implementation and
handling? Perhaps also to tie it in to have a JsonModel just as the
XmlListModel uses XML?
> 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.
>
/me keen to find a spare weekend to check this out.
> 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.
Would this enable us to store complete binary chunks (files, network
dumps etc..) as BSON allows? I have some use cases for this if this is
possible.
>
> The binary representation is optimized for fast reading. The binary format
> is relatively compact and stores the whole object in one blob.
Is this a standard binary format of JSON, or something of your own devise?
> 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.
Many thanks for this!
-Sivan
More information about the Development
mailing list