We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I create a json object and save it in file:
json root = { { "information", { {"model", 1}, {"dof", 6}, {"aux dof", 0} } }, { "cartisian limit", { { "translation", { {"velocity", 1}, {"acceleration", 1}, {"deceleration", 1}, {"jerk", 1} } }, { "rotation", { {"velocity", 1}, {"acceleration", 1}, {"deceleration", 1}, {"jerk", 1} } } } } }; std::ofstream ob("robot_params.json"); ob << std::setw(4) << root << std::endl;
And the file robot_params.json looks like this:
{ "cartisian limit": { "rotation": { "acceleration": 1, "deceleration": 1, "jerk": 1, "velocity": 1 }, "translation": { "acceleration": 1, "deceleration": 1, "jerk": 1, "velocity": 1 } }, "information": { "aux dof": 0, "dof": 6, "model": 1 } }
But what I need is saving the json object in order like this:
{ "information": { "model": 1, "dof": 6, "aux dof": 0 }, "cartisian limit": { "translation": { "velocity": 1, "acceleration": 1, "deceleration": 1, "jerk": 1 }, "rotation": { "velocity": 1, "acceleration": 1, "deceleration": 1, "jerk": 1 } } }
Please let me know is it feasible to do so?
The text was updated successfully, but these errors were encountered:
This seems related to https://github.com/nlohmann/json#order-of-object-keys. The library does not preserve the order of object keys.
Sorry, something went wrong.
It solved my problem!Thanks for you reply.
To be fixed with #2258.
nlohmann
Successfully merging a pull request may close this issue.
I create a json object and save it in file:
And the file robot_params.json looks like this:
But what I need is saving the json object in order like this:
Please let me know is it feasible to do so?
The text was updated successfully, but these errors were encountered: