Closed fx-lange closed 9 years ago
maybe https://github.com/miloyip/rapidjson
https://github.com/nlohmann/json looks really great but does not keep track of the insertion order ...
rapidjson indeed works for parsing the gui to json without loosing the order: https://github.com/fx-lange/ofxSyncedParams/tree/rapidjson works for the datGui example.
but of course in the remote example the order is still alphabetic because I'm still using jsoncpp objects to setup the ofxGui.
I think adding an orderIdx as an attribute might be the better choice: jsoncpp is more common in the oF community, no additional libraries, less work ...
added an orderIdx
now for both cases (oF -> oF and oF -> datGui) the order in the remoteUIs is correct
The order of keys is not specified in JSON and JsonCpp uses std::map. This results in an alphabetic order instead of the order the elements are added.
http://stackoverflow.com/questions/7582300/jsoncpp-stop-making-it-write-based-on-elements-alphabetical-order