Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
src_corelib_serialization_qjsonobject.cpp
Go to the documentation of this file.
1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#include <QJsonObject>
5
6void example()
7{
8 //! [1]
9 QJsonObject obj{
10 { "something", "is" },
11 { "in", "this" },
12 { "object", 42 },
13 };
14
15 for (auto [key, value] : obj.asKeyValueRange()) {
16 qDebug() << key << "->" << value;
17 if (key == "object")
18 value = "!"; // modify the object at this key
19 }
20 qDebug() << obj["object"]; // QJsonValue(string, "!")
21 //! [1]
22}
void example()
[5]