QBinaryJson Namespace▲
-
Header: QBinaryJson
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS Core5Compat)
target_link_libraries(mytarget PRIVATE Qt6::Core5Compat)
-
qmake: QT += core5compat
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 https:// whether to validate the binary data when converting to a https:// using fromBinaryData() or fromRawData().
|
Constant |
Value |
Description |
|---|---|---|
|
https://::Validate |
0 |
Validate the data before using it. This is the default. |
|
https://::BypassValidation |
1 |
Bypasses 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. |
Function Documentation▲
const Q_CORE5COMPAT_EXPORT *QBinaryJson::toRawData(const class QJsonDocument &document, int *size)▲
Returns the raw binary representation of document. size will contain the size of the returned data.
This method is useful to e.g. stream the JSON document in its binary form to a file.
The binary JSON encoding is only retained for backwards compatibility. It is undocumented and restrictive in the maximum size of JSON documents that can be encoded. Qt JSON types can be converted to Qt CBOR types, which can in turn be serialized into the CBOR binary format and vice versa. The CBOR format is a well-defined and less restrictive binary representation for a superset of JSON.
See Also▲
See also https://, fromBinaryData(), toBinaryData(), QCborValue


