Open
Description
For the lack of a more readily available example, suppose I'm trying to parse the JSON data at the URL https://a.4cdn.org/a/catalog.json
.
(inside a void function)
(threads is a std::map<unsigned int, utility::string_t>)
(previous task is response.extract_json(); )
.then([&threads](pplx::task<web::json::value> &value) {
auto catalog = value.get();
for (const auto &page : catalog.as_array()) {
for (const auto &thread : page.at(U("threads")).as_array()) {
unsigned int thread_no = thread.at(U("no")).as_number().to_uint32();
threads.emplace(thread_no, thread.at(U("com")).as_string());
}
}
}).wait();
This causes the program to die even though it is not outputting any text to the console.
I understand that the reason is because the web site returns text with unicode characters embedded in it, and the JSON parser choked on it.
- If I do
response.extract_string()
instead (in the previous task), it prints to the console just fine. - If I try to print
value.get().to_string()
, it dies on the console as well. - Merely printing
value.type()
causes the console to die as well.
It appears that any action that tries to access the member containing JSON data will cause the program to crash.
Metadata
Metadata
Assignees
Labels
No labels