QJsonDocument auto sorting
-
Hi,
I'm loading some data from a JSON file to a QJsonDocument, editing, and writing back to file. I see that QJsonDocument automatically sorts objects alphabetically. So when I write to file, everything is sorted in that order, which I would like not happen. Is there a way to avoid this?
Cheers.
-
AFAIK you can't. A JSON object is an unordered set of name-value pairs. This means that the order is implementation specific. In case of Qt this is probably (I haven't checked) a QMap, which holds its data in sorted-by-key order.