-
-
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
Automatic ordered JSON #424
Comments
https://github.com/nlohmann/json/blob/master/.github/CONTRIBUTING.md
|
|
Hi. A quick question regarding this issue (just out of curious): why not use std::unordered_map by default instead of std::map? After all, json objects are unsorted by semantics. And unordered_map should gain significant speed up regarding the time complexity. |
The problem is that we are defining an object |
Hi, is there any way to sort nlohmann::json depending upon values, like for example, |
Can you give an example for this? |
Example: |
This is not possible in the library (see https://github.com/nlohmann/json#order-of-object-keys). You could parse the value into some C++ container (e.g., a vector of pairs) and sort it yourself. |
Thanks for the support. |
Hey, is there a way to use std::max_element with nlohmann::json to get the key-value pair with the highest value for the above-given example? |
You may be able to achieve this via the |
To be fixed with #2258. |
Hi,
Json is automatically sorted by an alphabetic order. I don't find any information about that in your readme. Is there a way to avoid sorting ?
The text was updated successfully, but these errors were encountered: