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

turning an object into an array #3547

Closed
2 tasks
azchatlanin opened this issue Jun 19, 2022 · 1 comment
Closed
2 tasks

turning an object into an array #3547

azchatlanin opened this issue Jun 19, 2022 · 1 comment
Labels
kind: bug solution: duplicate the issue is a duplicate; refer to the linked issue instead

Comments

@azchatlanin
Copy link

azchatlanin commented Jun 19, 2022

Description

Good afternoon. I can make mistakes in actions. But when I do initialization through curly brackets, I get an array instead of the expected object.

Reproduction steps

For examle

using json = nlohmann::json;

int main()
{
  std::string str = "{ \"uuu\": 123 }";
  json j = json::parse(str);
  json a {  j  }; // a is array of objects ["{ \"uuu\": 123 }"]
  json b {  a  }; // b is array of array of objects [["{ \"uuu\": 123 }"]]
}

Expected vs. actual results

I would like to see the same object

Minimal code example

No response

Error messages

No response

Compiler and operating system

g++

Library version

last

Validation

@nlohmann
Copy link
Owner

Duplicate if #2583

@nlohmann nlohmann added the solution: duplicate the issue is a duplicate; refer to the linked issue instead label Jun 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug solution: duplicate the issue is a duplicate; refer to the linked issue instead
Projects
None yet
Development

No branches or pull requests

2 participants