-
-
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
Idea: Handle Multimaps Better #816
Comments
Interesting idea. I would like to discuss this. |
@nlohmann It seems that the actual behavior differs from the documented behavior, at least in the case of |
@Exaeta What do you mean? |
Coming back to your original idea about multisets: How would we translate back from JSON to multisets? Would we require the same structure; that is, would |
Any opinions on this? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I found this behavior surprising because it loses data. I'm going to convert my multimaps into |
It's surely a corner-case for which an implementation must make a decision as there is no canonic representation here. Any proposal how to improve the documentation to avoid surprises? |
My understanding is that currently:
Might map to:
{ "a": "1", "b": "3" }
But this does not preserve equality of the conversion back and forth. Thus I suggest a different way to convert multi-maps:
{ "a": ["1", "2"], "b": ["3"] }
This preserves equality.
The text was updated successfully, but these errors were encountered: