items() method does not follow order of json message #3278
Labels
kind: question
solution: proposed fix
a fix for the issue has been proposed and waits for confirmation
What is the issue you have?
Thank you for this library, it has been a real help! I am trying to pass JSON into a c++ code from another Javascript code and everything is working well. One thing I observed however is that the c++ iterator method seems to ignore the order that the JSON keys are in.
Please describe the steps to reproduce the issue.
In the print statement above, cleaning_zone_1 is the first key but when printing out the keys using the items() method the order gets changed for some reason
Can you provide a small but working code example?
What is the expected behavior?
I was under the impression that the first key, el.key() should have printed out cleaning_zone_1.
And what is the actual behavior instead?
Instead, cleaning_zone_0 is printed out
Which compiler and operating system are you using?
Compiler: gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Operating system: Ubuntu 20.04
Which version of the library did you use?
I'm sorry, i'm new to this and am not sure which library it is using. This is listed as part of my ROS dependency which I believe installs from the ROS build farm as listed here: https://index.ros.org/d/nlohmann-json-dev/
develop
branchThe text was updated successfully, but these errors were encountered: