You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Contrary to the spec at http://www.ietf.org/rfc/rfc7159.txt, the JsonReader class accepts not only true and false as valid Boolean values, but TRUE and FALSE, True and False, and even TrUe and fAlSe. This occurs no matter what the value of lenient is set to.
In writing my own TypeAdapter, I'd like to be able to decide whether I'll only accept true and false or whether other mixtures of case would be acceptable, but there's no public method I can find that will let me access the next token itself.
It seems like it should be possible to have peek() only return a JsonToken.BOOLEAN if the next value is really true or false and then have a JsonToken.UNQUOTED_VALUE that people could check for if they wanted to accept alternate cased versions.
Is this an oversight, a conscious design decision, or something no one else has complained about?
The text was updated successfully, but these errors were encountered:
This is at least now mentioned in the documentation for JsonReader.setLenient (see #2122) but that does not necessarily mean that this behavior is desired.
Contrary to the spec at http://www.ietf.org/rfc/rfc7159.txt, the
JsonReader
class accepts not onlytrue
andfalse
as valid Boolean values, butTRUE
andFALSE
,True
andFalse
, and evenTrUe
andfAlSe
. This occurs no matter what the value oflenient
is set to.In writing my own
TypeAdapter
, I'd like to be able to decide whether I'll only accepttrue
andfalse
or whether other mixtures of case would be acceptable, but there's nopublic
method I can find that will let me access the next token itself.It seems like it should be possible to have
peek()
only return aJsonToken.BOOLEAN
if the next value is reallytrue
orfalse
and then have aJsonToken.UNQUOTED_VALUE
that people could check for if they wanted to accept alternate cased versions.Is this an oversight, a conscious design decision, or something no one else has complained about?
The text was updated successfully, but these errors were encountered: