-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Incorrect namespace in C++ to/from json (nlohmann) #1185
Comments
I am facing a similar issue with Visual Studio 2017. What I have done is to add an additional
I can create a PR for this, but haven't had time to run tests. Here's the diff:
|
Confirmed in Visual Studio 2019. |
@schani As to the linked issue (nlohmann/json#780 (comment)) the fix described by @smalhotra-spirent correctly solves the problem and better complies with the C++ standard. His fix only adds a new option, thus it can't even break backwards compatibility and is the only chance to get it to compile with the latest Microsoft compiler (I think after a short test phase, it should get the default though). If it helps to speed things up, I could also create a pull request with @smalhotra-spirent's fix. |
Using MSVC-2022 with c++-20 enabled resolves the problem. |
While the solution is very simple, the issue cause recurring support in the popular Nlohmann repo |
The to_json/from_json functions should be in the same namespace as the structure. I'm using Visual Studio 2017 (VC++)
Additional information: nlohmann/json#780 (comment)
QuickType Code Gen
Working Code
The text was updated successfully, but these errors were encountered: