Skip to content
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

Adding a value to an existing json puts it at the beginning instead of the end #2149

Closed
tawmoto opened this issue May 29, 2020 · 2 comments · Fixed by #2258
Closed

Adding a value to an existing json puts it at the beginning instead of the end #2149

tawmoto opened this issue May 29, 2020 · 2 comments · Fixed by #2258
Assignees
Labels
release item: ✨ new feature solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Milestone

Comments

@tawmoto
Copy link

tawmoto commented May 29, 2020

This is a minor problem, but I think it's worth to mention it.

json j2 = {
	{"pi",    3.141},
	{"happy", true}};

j2["abc"] = "123";

std::cout << j2.dump(4) << std::endl;

I get as output

{
    "abc": "123", -->> shouldn't this be at the end? Because I inserted it later in the json
    "happy": true,
    "pi": 3.141
}

How can I insert it at the end, except creating another json and using update function?
Thanks

@nlohmann
Copy link
Owner

@nlohmann nlohmann self-assigned this Jul 11, 2020
@nlohmann nlohmann added this to the Release 3.8.1 milestone Jul 11, 2020
@nlohmann nlohmann added release item: ✨ new feature solution: proposed fix a fix for the issue has been proposed and waits for confirmation labels Jul 11, 2020
@nlohmann nlohmann reopened this Jul 11, 2020
@nlohmann
Copy link
Owner

To be fixed with #2258.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release item: ✨ new feature solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants