Skip to content

PythonQt.QtCore.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
Bool attribute Any
Double attribute Any
Null attribute Any
Object attribute Any
String attribute Any
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
__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
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
isBool function (self) -> bool X.isBool() -> bool
isDouble function (self) -> bool X.isDouble() -> bool
isNull function (self) -> bool X.isNull() -> bool
isObject function (self) -> bool X.isObject() -> bool
isString function (self) -> bool X.isString() -> bool
isUndefined function (self) -> bool X.isUndefined() -> bool
operator_assign function (self, other: Any) -> Any X.operator_assign(other) -> PythonQt.QtCore.QJsonValue
toArray function (self, defaultValue: Any) -> Any X.toArray(defaultValue) -> PythonQt.QtCore.QJsonArray
toBool function (self, defaultValue: bool) -> bool X.toBool(defaultValue) -> bool
toDouble function (self, defaultValue: float) -> float X.toDouble(defaultValue) -> float
toInt function (self, defaultValue: int) -> int X.toInt(defaultValue) -> int
toObject function (self, defaultValue: Any) -> Any X.toObject(defaultValue) -> PythonQt.QtCore.QJsonObject
toString function (self, defaultValue: Any) -> str X.toString(defaultValue) -> str
toVariant function (self) -> Any X.toVariant() -> object
type function (self) -> Any Returns the type of the value.