Skip to content

Commit 3017f68

Browse files
committed
Example code for the QJsonObject conversion is added
1 parent 940e319 commit 3017f68

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Examples/example.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,14 @@ int main(int argc, char *argv[])
6464
qDebug() << answer_to_everything;
6565
qDebug() << text_everything;
6666

67+
//For reverse application, tagged objects can be filled manually, then can be converted to QJsonObjects
68+
OuterClass secondObject{};
69+
secondObject.example_int = 12;
70+
secondObject.example_sub_class = InnerClass{TaggedJSONString{"12"}, true};
71+
secondObject.example_arr = TaggedJSONStringArray{{"Manual", "Placement"}};
72+
const QJsonObject jsonObj = secondObject.toJsonObject();
73+
74+
qDebug() << QJsonDocument(jsonObj).toJson();
75+
6776
return 0;
6877
}

0 commit comments

Comments
 (0)