You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
They are ordered by key, because they are internally stored in a container of type std::map<std::string, nlohmann::json> which by default uses std::less<std::string> as order. This default can be overridden by setting a different template parameter ObjectType. To be able to compile the code, this type has to conform to the AssociativeContainer concept.
I know there may be situations where it would be convenient to rely on a certain order of JSON object's elements, it would at the same time be non-compliant, because JSON defines objects as unordered list of values.
Let's say I have the json from the example readme:
I will iterate over it the following way:
I would expect this:
Instead, I get:
Why is this the default? Can it be turned off?
The text was updated successfully, but these errors were encountered: