fix(JSON::Stringifier): JSON Serializing NAN #3251

This commit is contained in:
Alex Fabijanic
2022-06-22 13:44:00 +02:00
parent 5cbe30e199
commit cafd56a947
3 changed files with 15 additions and 0 deletions

View File

@@ -62,6 +62,8 @@ void Stringifier::stringify(const Var& any, std::ostream& out, unsigned int inde
else if (any.isNumeric() || any.isBoolean())
{
std::string value = any.convert<std::string>();
if ((Poco::icompare(value, "nan") == 0) ||
(Poco::icompare(value, "inf") == 0)) value = "null";
if (any.type() == typeid(char)) formatString(value, out, options);
else out << value;
}