18static bool ParsePrechecks(
const std::string& str)
24 if (str.size() != strlen(str.c_str()))
29std::optional<double> ParseDouble(
const std::string& str)
31 if (!ParsePrechecks(str))
33 if (str.size() >= 2 && str[0] ==
'0' && str[1] ==
'x')
35 std::istringstream text(str);
36 text.imbue(std::locale::classic());
39 if (!text.eof() || text.fail()) {
55 throw std::runtime_error(
"JSON value is not an object or array as expected");
74 if (
const auto retval{ParseDouble(
getValStr())}) {
77 throw std::runtime_error(
"JSON double out of range");
const std::string & get_str() const
const std::string & getValStr() const
const UniValue & get_obj() const
const std::vector< UniValue > & getValues() const
const std::vector< std::string > & getKeys() const
std::vector< UniValue > values
std::vector< std::string > keys
void checkType(const VType &expected) const
const UniValue & get_array() const
static bool json_isspace(int ch)