The QMJsonObject implements a JSON object. Internally, the QMJsonObject is a QHash<QString, QMPointer<QMJsonValue> >. Thus, all of the rules that apply to QHash with respect to performance are basically the same with QMJsonObject. Like the rest of the QtMark JSON Library, all of the QMJsonValues stored in the QMJsonObject as stored as QMPointers.
Like all of the classes in this library, QMJsonObject must be created using a managed QMPointer.
There is basically one way to add items to a QMJsonObject:
There is no needed to manually wrap a value in a QMJsonValue, as this will be done for you:
There are also a number of functions to remove an item from the QMJsonObject. These are:
QMJsonObject::isEmpty will tell you if the QMJsonObject has any QMJsonValues in it. You can also call QMJsonObject::count to get the current number of QMJsonValues in the QMJsonObject.
Both the QMJsonObject and QMJsonArray classes provide the QMJsonValue unwrap functions for convenience. This applies for:
Allowing for shorthand conversions:
To convert a QMJsonObject to JSON, you must wrap the QMJsonObject in a QMJsonValue and use QMJsonValue::toJson and QMJsonValue::fromJson