QJsonArray Class

The QJsonArray class encapsulates a JSON array. More...

Header: #include <QJsonArray>
qmake: QT += core
Since: Qt 5.0

This class was introduced in Qt 5.0.

Note: All functions in this class are reentrant.

Public Types

class const_iterator
class iterator
typedef ConstIterator
typedef Iterator
typedef const_pointer
typedef const_reference
typedef difference_type
typedef pointer
typedef reference
typedef size_type
typedef value_type

Detailed Description

A JSON array is a list of values. The list can be manipulated by inserting and removing QJsonValue's from the array.

A QJsonArray can be converted to and from a QVariantList. You can query the number of entries with size(), insert(), and removeAt() entries from it and iterate over its content using the standard C++ iterator pattern.

QJsonArray is an implicitly shared class and shares the data with the document it has been created from as long as it is not being modified.

You can convert the array to and from text based JSON through QJsonDocument.

See also JSON Support in Qt and JSON Save Game Example.

Member Type Documentation

typedef QJsonArray::ConstIterator

Qt-style synonym for QJsonArray::const_iterator.

typedef QJsonArray::Iterator

Qt-style synonym for QJsonArray::iterator.

typedef QJsonArray::const_pointer

Typedef for const QJsonValue *. Provided for STL compatibility.

typedef QJsonArray::const_reference

Typedef for const QJsonValue &. Provided for STL compatibility.

typedef QJsonArray::difference_type

Typedef for int. Provided for STL compatibility.

typedef QJsonArray::pointer

Typedef for QJsonValue *. Provided for STL compatibility.

typedef QJsonArray::reference

Typedef for QJsonValue &. Provided for STL compatibility.

typedef QJsonArray::size_type

Typedef for int. Provided for STL compatibility.

typedef QJsonArray::value_type

Typedef for QJsonValue. Provided for STL compatibility.