JsonWax for create json
-
Hello, someone in the community who is or has used the jsonwax library to create a json file. I am creating a file and I realized that the elements that you are creating are ordered alphabetically and I do not want that to happen
-
Hi and welcome to the forum
Looking in the code,
i dont think its possible to alter that.
There seem to be no options to control it.Also the docs says:
"When converting JsonWax's internal format back to a string, the JSON-Object will always have its keys sorted alphabetically, and JSON-Arrays will always keep the same order."Internally a QMap is used and i think that is where the sorting comes from.
https://github.com/doublejim/JsonWax/blob/master/JsonWaxEditor.h
line 230
QMap<QString, JsonType*> MAP;Can I ask why you want them not ordered ?
JSON normally does not guarantee any order of the keys in objects and
it should not be important for the using code as the app will break very asy.But maybe there is another way to solve what you need.
-
Double post - already answered here: https://forum.qt.io/topic/79451/how-to-integrate-qjson-in-qt-window-application-windows-64-bit-system/11