[Development] State of "binary JSON" in 5.15+?

Lars Knoll lars.knoll at qt.io
Tue Apr 13 16:29:48 CEST 2021

Hi Brett,

The binary JSON support is deprecated and only there for backwards compatibility. It had some issues (e.g. it couldn’t handle large JSON files), that’s why we deprecated it. It’s gone in Qt 6. I guess the docs need some adjustment though.


On 13 Apr 2021, at 15:43, Stottlemyer, Brett (B.S.) <bstottle at ford.com<mailto:bstottle at ford.com>> wrote:


I was at the Contributor’s Summit where it was discussed, so I know there were good reasons to deprecate the binary json format.  The actual changes looks to have been done in https://codereview.qt-project.org/c/qt/qtbase/+/265312.

IIUC, the original intent was that parsing the JSON creates a lookup table to speed up subsequent access, and the binary format saved that table to disk (or for streaming).  This allowed “opening the JSON” (technically no longer JSON?) much more quickly.

Is such a mechanism still available currently?  Or is parsing the data from scratch necessary now?

For reference, I tried the deprecated calls and also used the conversion tool to convert to CBOR and tried reading that.  With a particular (~20MB) JSON file from a REST call, parsing the CBOR version of the file was about twice as fast as JSON, while the binary JSON format was about 2.5x *slower* than parsing the JSON (just measuring the document creation time).

FWIW, if the capability is no longer available, the overview for Qt JSON (https://doc.qt.io/qt-5/json.html) should probably have “It also contains support for saving this data in a binary format that is directly "mmap"-able and very fast to access” removed.


Development mailing list
Development at qt-project.org<mailto:Development at qt-project.org>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20210413/672a6a36/attachment-0001.html>

More information about the Development mailing list