Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
5.15.0 RC2
-
None
-
-
What I need to do is to read the A.json file,modify some case, and then store it in a new file of the same format, which is now saved as b.json file . Obviously, this is not satisfactory. Is there any way I can save it in the format of a.json file?
Description
How to avoid automatic sorting by name when saving JSON files with QJsonObject?
for example:
void SaveJson()
{
QJsonObject sub;
sub.insert("serial",QJsonValue(serial));
sub.insert("name",QJsonValue(name));
obj.insert("server",QJsonValue(sub));
{{}}
QJsonDocument doc(sub);
QByteArray data=doc.toJson();
{{ QFile file("D:
test1.json");}}
{{ file.open(QIODevice::WriteOnly);}}
{{ file.write(data);}}
{{ file.close();}}
}
The result will be "name serial server".How can I avoid automatic sorting by name?