-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
when enum is used as key in a map the json format is not an expected format #4378
Comments
If I wanted to work on this, would I just fork and then submit a PR? Do I need to be assigned to work on this? |
Yes!
Nope. |
I'm planning to look into this issue. |
Call inline void to_json(BasicJsonType& j, const CompatibleArrayType& arr) and inline void to_json(BasicJsonType& j, const CompatibleObjectType& obj) It seems |
@nlohmann Sorry for the lack of update, some stuffs came up that prevent me from focusing on this issue. Thanks for the insight, I will look into it right away to see what can be done. |
@nlohmann The error messages that I get is: Also, I notice that this issue only arise if we use a map object as an argument to |
Passing an initializer list vs. passing a |
Description
I would expect map to be parsed as json objects eg.
{"aa":"completed","bb":"running"}
In fact this json format is dependent on the key type. When the key type is string, the json is created as expected.
When the key type is an enum, the map is parsed as json array eg.
[["stopped","aa"],["completed","bb"]]
Reproduction steps
Expected vs. actual results
I would expect both cases to look in same format:
enum_in_key_nohlman: {"stopped","aa","completed","bb"}
enum_in_val_nohlman: {"aa":"completed","bb":"running"}
Minimal code example
Error messages
Compiler and operating system
linux
Library version
3.6.1
Validation
develop
branch is used.The text was updated successfully, but these errors were encountered: