Obsolete Members for QBinaryJson
The following members of class QBinaryJson are deprecated. They are provided to keep old source code working. We strongly advise against using them in new code.
Functions
(deprecated in 6.12) const char * | toRawData(const QJsonDocument &document, int *size) |
Function Documentation
[deprecated in 6.12] const char *QBinaryJson::toRawData(const QJsonDocument &document, int *size)
This function is deprecated since 6.12. We strongly advise against using it in new code.
Use toBinaryData() instead.
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.
Warning: In Qt 6, unlike Qt 5, the caller takes ownership of the returned data and must release it with free() once it is not needed anymore. Use toBinaryData() to get the binary representation in a QByteArray, which manages the memory automatically.
Note: 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 fromRawData(), fromBinaryData(), toBinaryData(), and QCborValue.
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.