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.
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.
}
});