Skip to content

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

Open
@511844767

Description

@511844767

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions