Obsolete Members for QJsonDocument
The following members of class QJsonDocument are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.
Public Functions
(obsolete) const char * | rawData(int *size) const |
(obsolete) QByteArray | toBinaryData() const |
Static Public Members
(obsolete) QJsonDocument | fromBinaryData(const QByteArray &data, QJsonDocument::DataValidation validation = Validate) |
(obsolete) QJsonDocument | fromRawData(const char *data, int size, QJsonDocument::DataValidation validation = Validate) |
Member Function Documentation
[static]
QJsonDocument QJsonDocument::fromBinaryData(const QByteArray &data, QJsonDocument::DataValidation validation = Validate)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Creates a QJsonDocument from data.
validation decides whether the data is checked for validity before being used. By default the data is validated. If the data is not valid, the method returns a null document.
Note: Deprecated in Qt 5.15. 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 toBinaryData(), fromRawData(), isNull(), DataValidation, and QCborValue.
[static]
QJsonDocument QJsonDocument::fromRawData(const char *data, int size, QJsonDocument::DataValidation validation = Validate)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Creates a QJsonDocument that uses the first size bytes from data. It assumes data contains a binary encoded JSON document. The created document does not take ownership of data. The data is copied into a different data structure, and the original data can be deleted or modified afterwards.
data has to be aligned to a 4 byte boundary.
validation decides whether the data is checked for validity before being used. By default the data is validated. If the data is not valid, the method returns a null document.
Returns a QJsonDocument representing the data.
Note: Deprecated in Qt 5.15. 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.
Note: Before Qt 5.15, the caller had to guarantee that data would not be deleted or modified as long as any QJsonDocument, QJsonObject or QJsonArray still referenced the data. From Qt 5.15 on, this is not necessary anymore.
See also rawData(), fromBinaryData(), isNull(), DataValidation, and QCborValue.
const char *QJsonDocument::rawData(int *size) const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns the raw binary representation of the data 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.
Note: Deprecated in Qt 5.15. 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 QCborValue.
QByteArray QJsonDocument::toBinaryData() const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns a binary representation of the document.
The binary representation is also the native format used internally in Qt, and is very efficient and fast to convert to and from.
The binary format can be stored on disk and interchanged with other applications or computers. fromBinaryData() can be used to convert it back into a JSON document.
Note: Deprecated in Qt 5.15. 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 fromBinaryData() and QCborValue.
© 2024 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.