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

Failed to insert std::string into Json::Value when using MSVC #1587

Open
511844767 opened this issue Dec 16, 2024 · 0 comments
Open

Failed to insert std::string into Json::Value when using MSVC #1587

511844767 opened this issue Dec 16, 2024 · 0 comments

Comments

@511844767
Copy link

Using the test code:

#include <iostream>
#include "json/json.h"

int main()
{
    Json::Value root;
    root["key1"] = "value1";
    root["key2"] = std::string{"value2"};
    std::cout << root << std::endl;
}

When I compile the code with MSVC(Windows SDK 10.0.22621.0, Visual Studio 2022 (v143)), the output is

{
"key1" : "value1",
"key2" : ""
}

But when I comile the code with GCC 10.5.0, the output is

{
        "key1" : "value1",
        "key2" : "value2"
}

I think it is a bug in the MSVC platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant