Rethink AJson object container approach
This discussion is started in #261.
Summary: we need a way to keep order of fields in AJson (Json::Object).
I generally agree that order should be kept in json objects, but unordered_map does not guarantee the persistence of order. Another container should be used. Even std::vector<std::pair<AString, AJson>> seems acceptable. Furthermore, you may take a look at ASmallVector.
nlohmann json uses std::map as the default container for object. It also offers alternative object type which is implemented as vector of string-json pair. https://json.nlohmann.me/features/object_order/
Originally posted by @Alex2772 in https://github.com/aui-framework/aui/issues/261#issuecomment-2016961465
@na2axl
I've added Google Benchmark initial support (#262). I'll check for performance of vector variant in my spare time.
For this maybe a AJsonObject class which extends AVector<std::pair<AString, AJson>> and adds index operators for AString ?
For this maybe a
AJsonObjectclass which extendsAVector<std::pair<AString, AJson>>and adds index operators forAString?
I think I will come up with something like this.
Hey @Alex2772, I don't know if you still have plans for this but I can confirm the new AJsonObject implementation works fine for my use case 🎉
Hi @na2axl, great news! There are no extra work planned on this, so we can close this as resolved.