ipkn / crow

Crow is very fast and easy to use C++ micro web framework (inspired by Python Flask)
BSD 3-Clause "New" or "Revised" License
7.43k stars 889 forks source link

Error in JSON Parser #254

Open seppelandrio opened 6 years ago

seppelandrio commented 6 years ago

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_));

davidkennedydev commented 6 years ago

Why do you not made a PR?