I have simple C++ code that uses Boost library:
auto jsonStringPtr = jsonValuePtr->if_string();
How can I convert this value to std::string without quotes?
I tested this code:
std::string myString = boost::json::serialize(*jsonStringPtr);
but it contains quotes e.g. "abc" insted of abc... Any idea?
#edit
- Boost: v1.76.0
- C++: 20
Example:
boost::json::error_code errorCode;
boost::json::value jsonValue = boost::json::parse("{\"fff\": \"abc\"}", errorCode);
auto jsonString = jsonValue.as_object()["fff"].as_string();
std::string myString = boost::json::serialize(jsonString);