mirror of
https://github.com/nlohmann/json.git
synced 2025-07-28 12:02:00 +03:00
Merge branch 'develop' into feature/jsontestsuite
This commit is contained in:
@ -9121,6 +9121,13 @@ basic_json_parser_66:
|
|||||||
{
|
{
|
||||||
// parse with strtod
|
// parse with strtod
|
||||||
result.m_value.number_float = str_to_float_t(static_cast<number_float_t*>(nullptr), NULL);
|
result.m_value.number_float = str_to_float_t(static_cast<number_float_t*>(nullptr), NULL);
|
||||||
|
|
||||||
|
// replace infinity and NAN by null
|
||||||
|
if (not std::isfinite(result.m_value.number_float))
|
||||||
|
{
|
||||||
|
type = value_t::null;
|
||||||
|
result.m_value = basic_json::json_value();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// save the type
|
// save the type
|
||||||
|
@ -8270,6 +8270,13 @@ class basic_json
|
|||||||
{
|
{
|
||||||
// parse with strtod
|
// parse with strtod
|
||||||
result.m_value.number_float = str_to_float_t(static_cast<number_float_t*>(nullptr), NULL);
|
result.m_value.number_float = str_to_float_t(static_cast<number_float_t*>(nullptr), NULL);
|
||||||
|
|
||||||
|
// replace infinity and NAN by null
|
||||||
|
if (not std::isfinite(result.m_value.number_float))
|
||||||
|
{
|
||||||
|
type = value_t::null;
|
||||||
|
result.m_value = basic_json::json_value();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// save the type
|
// save the type
|
||||||
|
@ -489,4 +489,10 @@ TEST_CASE("regression tests")
|
|||||||
j["/this/that/2"_json_pointer] = 27;
|
j["/this/that/2"_json_pointer] = 27;
|
||||||
CHECK(j == json({{"this", {{"that", {nullptr, nullptr, 27}}}}}));
|
CHECK(j == json({{"this", {{"that", {nullptr, nullptr, 27}}}}}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("issue #329 - serialized value not always can be parsed")
|
||||||
|
{
|
||||||
|
json j = json::parse("22e2222");
|
||||||
|
CHECK(j == json());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user