Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

New Post: The best way to convert utility::string_t and to_string() to std::string

$
0
0
Hi there

I'm using Microsoft Cpp REST SDK v1.2 with Visual Studio 2010.
My goal is to read json from web api.

Which is the best way to convert utility::string_t and to_string() to std::string

My code is the following
for(auto iter = obj.cbegin(); iter != obj.cend(); ++iter)
    {
        // Make sure to get the value as const reference otherwise you will end up copying 
        // the whole JSON value recursively which can be expensive if it is a nested object. 
        const json::value &str = iter->first;
        const json::value &v = iter->second;

    std::wcout << L"String: " << str.as_string() << L", Value: " << v.to_string() << std::endl;

    }

Viewing all articles
Browse latest Browse all 4845

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>