QBinaryJson Namespace

Contains functions for converting QJsonDocument to and from JSON binary format. More...

Header: #include <QBinaryJson>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core5Compat)
target_link_libraries(mytarget PRIVATE Qt6::Core5Compat)
qmake: QT += core5compat

Types

enum DataValidation { Validate, BypassValidation }

Detailed Description

This namespace provides utility functions to keep compatibility with older code, which uses the JSON binary format for serializing JSON. Qt JSON types can be converted to Qt CBOR types, which can in turn be serialized into the CBOR binary format and vice versa.

Type Documentation

enum QBinaryJson::DataValidation

This enum is used to tell QJsonDocument whether to validate the binary data when converting to a QJsonDocument using fromBinaryData() or fromRawData().

ConstantValueDescription
QBinaryJson::Validate0Validate the data before using it. This is the default.
QBinaryJson::BypassValidation1Bypasses data validation. Only use if you received the data from a trusted place and know it's valid, as using of invalid data can crash the application.