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
6
void
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
}
example
void example()
[5]
Definition
doc_src_groups.cpp:7
qtbase
src
corelib
doc
snippets
code
src_corelib_serialization_qjsonobject.cpp
Generated on
for Qt by
1.14.0