Closed GoogleCodeExporter closed 9 years ago
Err, sorry. Case #3 gives an error different from the first two. Doesn't even
make it
to the BigDecimalTypeAdapter, which is what I would expect in the original
input that
is allowed. Here are the exception messages by situation:
1. The JsonDeserializer BigDecimalTypeAdapter failed to deserialized json
object
"12345X67890" given the type class java.math.BigDecimal
2. The JsonDeserializer BigDecimalTypeAdapter failed to deserialized json
object
"12345X67890" given the type class java.math.BigDecimal
3. Failed parsing JSON source: java.io.StringReader@7f2a3793 to Json
Original comment by estebis...@gmail.com
on 25 Sep 2009 at 3:26
This is how the Gson's JSON parser works. In the first case, the lexical
analyzer
treats 12345 as one token and the remaining part as another. Your fromJson call
returns fine because Gson doesn't look at the input beyond what it needs. Your
other
methods fail because they force Gson to look beyond the first token.
Original comment by inder123
on 25 Sep 2009 at 5:29
So it's a documented feature of Gson's JSON parser that gargage is ignored in
the
stream? Seems like the overall JSON stream should fail, as this isn't valid
JSON when
viewed altogether.
Original comment by estebis...@gmail.com
on 25 Sep 2009 at 6:31
s/gargage/garbage/
bleh
Original comment by estebis...@gmail.com
on 25 Sep 2009 at 6:32
Original issue reported on code.google.com by
estebis...@gmail.com
on 25 Sep 2009 at 3:22