Skip to content

PythonQt.QtCore.QJsonDocument

QJsonDocument

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

QJsonDocument is a class that wraps a complete JSON document and can read and write this document both from a UTF-8 encoded text based representation as well as Qt's own binary format.

A JSON document can be converted from its text-based representation to a QJsonDocument using QJsonDocument::fromJson(). toJson() converts it back to text. The parser is very fast and efficient and converts the JSON to the binary representation used by Qt.

Validity of the parsed document can be queried with isNull()

A document can be queried as to whether it contains an array or an object using isArray() and isObject(). The array or object contained in the document can be retrieved using array() or object() and then read or manipulated.

A document can also be created from a stored binary representation using fromBinaryData() or fromRawData().

Source: https://doc.qt.io/archives/qt-5.15/qjsondocument.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
BypassValidation attribute Any
Compact attribute Any
DataValidation attribute type Convert a number or string to an integer, or return 0 if no arguments are given.
Indented attribute Any
JsonFormat attribute type Convert a number or string to an integer, or return 0 if no arguments are given.
Validate attribute Any
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
array function (self) -> Any X.array() -> PythonQt.QtCore.QJsonArray
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
fromBinaryData function (self, data: Any, validation: Any) -> Any X.fromBinaryData(data, validation) -> PythonQt.QtCore.QJsonDocument
fromJson function (self, json: Any, error: Any) -> Any X.fromJson(json, error) -> PythonQt.QtCore.QJsonDocument
fromRawData function (self, data: str, size: int, validation: Any) -> Any X.fromRawData(data, size, validation) -> PythonQt.QtCore.QJsonDocument
fromVariant function (self, variant: Any) -> Any X.fromVariant(variant) -> PythonQt.QtCore.QJsonDocument
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
isArray function (self) -> bool X.isArray() -> bool
isEmpty function (self) -> bool X.isEmpty() -> bool
isNull function (self) -> bool X.isNull() -> bool
isObject function (self) -> bool X.isObject() -> bool
object function (self) -> Any X.object() -> PythonQt.QtCore.QJsonObject
operator_assign function (self, other: Any) -> Any X.operator_assign(other) -> PythonQt.QtCore.QJsonDocument
rawData function (self, size: Any) -> int X.rawData(size) -> int
setArray function (self, array: Any) -> None Sets array as the main object of this document.
setObject function (self, object: Any) -> None Sets object as the main object of this document.
toBinaryData function (self) -> Any X.toBinaryData() -> PythonQt.QtCore.QByteArray
toJson function (self, format: Any) -> Any X.toJson(format) -> PythonQt.QtCore.QByteArray
toVariant function (self) -> Any X.toVariant() -> object