Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.9.0
-
None
-
8616b2112c0f24f71892488cefb146ae3505da9e
Description
For example:
qDebug() << QJsonDocument::fromJson( "\{\"key\": 0E-1}" ).object(); qDebug() << QJsonDocument::fromJson( "\{\"key\": 0e-1}" ).object(); qDebug() << QJsonDocument::fromJson( "\{\"key\": 1E-1}" ).object(); qDebug() << QJsonDocument::fromJson( "\{\"key\": 1e-1}" ).object();
Output:
QJsonObject() QJsonObject(\{"key":0}) QJsonObject(\{"key":0.1}) QJsonObject(\{"key":0.1})
The first example, QJsonDocument after parse can not output the correct results. QJsonDocument is null.
From Qt document (JSON Support in Qt)
Qt is to support RFC-4627, and RFC-4627 has said:
An exponent part begins with the letter E in upper or lowercase, which may be followed by a plus or minus sign. The E and optional sign are followed by one or more digits.
I also tried some JSON parsing tools, they can be normal analysis: {"key": 0E-1}
Such as this tool:
Attachments
Issue Links
- replaces
-
QTBUG-61756 [REG: 5.6.2->5.7.1]: QJsonDocument::fromJson() fails to parse special numbers such as "0E-8"
- Closed