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

New Post: Error reading characters of string.

$
0
0
Hello

My goal is to get json data from API

I get the following error
'Error reading characters of string.',
But status comes Ok (200) so I think problem related with json parsing

Please help.
This is my code.
http_client client(L"link");

        http_request request(methods::GET);
        request.headers().add(L"Accept", L"application/json");
    

        return client.request(request).then([](http_response response) -> pplx::task<json::value>
        {
            if (response.status_code() == status_codes::OK)
            {
                return response.extract_json();
            }

            // Handle error cases, for now return empty json value... 
            return pplx::task_from_result(json::value());
        })
            .then([](pplx::task<json::value> previousTask)
        {
            try
            {
                const json::value& v = previousTask.get();
                extract_json_issues(v);
                // Perform actions here to process the JSON value...
            }
            catch (const http_exception& e)
            {
                char * error = const_cast<char*>(e.what());
                // Error reading characters of string.
            }
        });

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>