path: root/src/corelib/json/qjson_p.h
diff options
authorDarryl L. Miles <>2013-02-10 07:18:42 +0000
committerThe Qt Project <>2013-04-12 22:33:13 +0200
commite2d614b6a9e88c90331e3de9bb339a2ed609ea95 (patch)
tree63040ef66ecfff3d779ddcd2d79ec201750ac949 /src/corelib/json/qjson_p.h
parentc002a274262808a7328dd59c31f0666d20072d47 (diff)
Json writer, only emit floating point finite numbers, ignore INF/NaN
My interpretation of RFC4627, Section 2.4 "Numbers" of: Numeric values that cannot be represented as sequences of digits (such as Infinity and NaN) are not permitted. I have also verified this matter with NodeJS JSON.stringify() that emitting a null is consistent behavior with a JSON implementation written in JavaScript. Previously Qt would emit: { plusInfinity: inf, minusInfinity: -inf, notANumber: nan } Which maybe turned into a string values of "inf", "-inf", "nan" by the receiving parser. Now it returns the JSON null value just like NodeJS JSON.stringify(). Change-Id: I9f9c17f12b2606280806c47a9d90465c4ba5f786 Reviewed-by: Thiago Macieira <>
Diffstat (limited to 'src/corelib/json/qjson_p.h')
1 files changed, 1 insertions, 0 deletions
diff --git a/src/corelib/json/qjson_p.h b/src/corelib/json/qjson_p.h
index 81439a00ce..8d6735273c 100644
--- a/src/corelib/json/qjson_p.h
+++ b/src/corelib/json/qjson_p.h
@@ -60,6 +60,7 @@
#include <qatomic.h>
#include <qstring.h>
#include <qendian.h>
+#include <qnumeric.h>
#include <limits.h>