You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to print out my JSON response to see what the problem is that's causing me to get the exception
[json.exception.type_error.302] type must be number, but is null
My code is on GitHub here. I'm currently trying to make it completely asynchronous so I can port it to WebAssembly (though I'll also need to port the ASIO and Beast libraries).
But for some reason, when I do it in this code, I get either an exception about the type being null or an exception about not being able to use operator[] with a string as the key with a number. And as you can see in my code, I also tried to print out the j_res object. Nothing from it gets printed, though. This is my output:
in cache_storage::query, query_data is:
from_currency: USD
to_currency: PKR
Line 929: target is: /api/live?access_key=6118470d67d40caf1f4db130ec67e1e8¤cies=PKR&format=1
hi from line 943 in cache_storage::query
from_currency: USD
to_currency: PKR
Line 895: Error: [json.exception.type_error.302] type must be number, but is null
And the problem is causing both the conversion rate and conversion result to come out to be 0. I'd really like some help here. Thanks in advance.
The text was updated successfully, but these errors were encountered:
Okay, I managed to solve it by making cache_storage::get_cache return a reference. I've also replaced the code in currency_converter.cpp with the async version and made it the only .cpp file in the repository. currency_converter_async.cpp is no longer there.
I need to print out my JSON response to see what the problem is that's causing me to get the exception
My code is on GitHub here. I'm currently trying to make it completely asynchronous so I can port it to WebAssembly (though I'll also need to port the ASIO and Beast libraries).
The exception came from here:
The
std::cerr << "Line 895: Error: " << e.what() << '\n';
line is where the output is from.I tried to make the HTTP GET request I'm trying to make in the code manually and I got back the JSON response I expected:
But for some reason, when I do it in this code, I get either an exception about the type being null or an exception about not being able to use operator[] with a string as the key with a number. And as you can see in my code, I also tried to print out the
j_res
object. Nothing from it gets printed, though. This is my output:And the problem is causing both the conversion rate and conversion result to come out to be 0. I'd really like some help here. Thanks in advance.
The text was updated successfully, but these errors were encountered: