Following code snippet leads to an exception:
crow::json::wvalue response; response["test"] = 100000000000; std::string test = crow::json::dump(response); auto answer = crow::json::load(test); int64_t test2 = answer["test"].i();
Problem:
Large numbers will be replaced with different string representation:
{"test":1e+11}
and boost::lexical_cast<int64_t> can't handle that.
Solving suggestion:
In function int64_t i() const
replace return boost::lexical_cast<int64_t>(start_, end_-start_);
with return std::stod(std::string(start_, end_ - start_));
Following code snippet leads to an exception:
crow::json::wvalue response; response["test"] = 100000000000; std::string test = crow::json::dump(response); auto answer = crow::json::load(test); int64_t test2 = answer["test"].i();
Problem: Large numbers will be replaced with different string representation:
{"test":1e+11}
andboost::lexical_cast<int64_t>
can't handle that.Solving suggestion: In
function int64_t i() const
replacereturn boost::lexical_cast<int64_t>(start_, end_-start_);
withreturn std::stod(std::string(start_, end_ - start_));