Skip to content

PythonQt.Qt.QJsonValue

QJsonValue

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

A value in JSON can be one of 6 basic types:

JSON is a format to store structured data. It has 6 basic data types:

A value can represent any of the above data types. In addition, QJsonValue has one special flag to represent undefined values. This can be queried with isUndefined().

The type of the value can be queried with type() or accessors like isBool(), isString(), and so on. Likewise, the value can be converted to the type stored in it using the toBool(), toString() and so on.

Values are strictly typed internally and contrary to QVariant will not attempt to do any implicit type conversions. This implies that converting to a type that is not stored in the value will return a default constructed return value.

QJsonValueRef

QJsonValueRef is a helper class for QJsonArray and QJsonObject. When you get an object of type QJsonValueRef, you can use it as if it were a reference to a QJsonValue. If you assign to it, the assignment will apply to the element in the QJsonArray or QJsonObject from which you got the reference.

The following methods return QJsonValueRef:

Source: https://doc.qt.io/archives/qt-5.15/qjsonvalue.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
Array attribute Any (shared captured text)
Bool attribute Any (shared captured text)
Double attribute Any (shared captured text)
Null attribute Any (shared captured text)
Object attribute Any (shared captured text)
String attribute Any (shared captured text)
Type attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
Undefined attribute Any (shared captured text)
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
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)
fromVariant function (self, variant: Any) -> Any X.fromVariant(variant) -> PythonQt.QtCore.QJsonValue (shared captured text)
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 (shared captured text)
isBool function (self) -> bool X.isBool() -> bool (shared captured text)
isDouble function (self) -> bool X.isDouble() -> bool (shared captured text)
isNull function (self) -> bool X.isNull() -> bool (shared captured text)
isObject function (self) -> bool X.isObject() -> bool (shared captured text)
isString function (self) -> bool X.isString() -> bool (shared captured text)
isUndefined function (self) -> bool X.isUndefined() -> bool (shared captured text)
operator_assign function (self, other: Any) -> Any X.operator_assign(other) -> PythonQt.QtCore.QJsonValue (shared captured text)
toArray function (self, defaultValue: Any) -> Any X.toArray(defaultValue) -> PythonQt.QtCore.QJsonArray (shared captured text)
toBool function (self, defaultValue: bool) -> bool X.toBool(defaultValue) -> bool (shared captured text)
toDouble function (self, defaultValue: float) -> float X.toDouble(defaultValue) -> float (shared captured text)
toInt function (self, defaultValue: int) -> int X.toInt(defaultValue) -> int (shared captured text)
toObject function (self, defaultValue: Any) -> Any X.toObject(defaultValue) -> PythonQt.QtCore.QJsonObject (shared captured text)
toString function (self, defaultValue: Any) -> str X.toString(defaultValue) -> str (shared captured text)
toVariant function (self) -> Any X.toVariant() -> object (shared captured text)
type function (self) -> Any Returns the type of the value. (shared captured text)