This initialization is possible and can make the json::value object with the value of "hello1" as follows.
json::value v1 = json::value::string(U("hello1")); // ok
But this initialization is not working. What is the reason for that? How to create a JSON object by using the value of a variable such as string or char*.
string str1 = "Hello2";
json::value v2 = json::value::string(str1); //Error (1)
json::value v3 = json::value::string(U(str1)); //Error (2)
Error 1
Severity Code Description Project File Line Suppression State
Error C2248 'web::json::value::string': cannot access private member declared in class 'web::json::value' StolenDetailsService c:\users\nuwanst\source\repos\stolendetailsservice\stolendetailsservice\dbhandler.cpp 62
Error 2
Severity Code Description Project File Line Suppression State
Error C2065 'Lstr1': undeclared identifier StolenDetailsService c:\users\nuwanst\source\repos\stolendetailsservice\stolendetailsservice\dbhandler.cpp 62