Closed GoogleCodeExporter closed 9 years ago
For backwards compatibility, JsonParser is always lenient. Use JsonReader for
strict parsing.
Original comment by limpbizkit
on 4 Feb 2013 at 4:06
With JsonReader, it still works:
JsonReader reader = new JsonReader(new StringReader("{invalid: 1}"));
reader.setLenient(false);
new JsonParser().parse(reader).getAsJsonObject().get("invalid").getAsInt();
Or did you mean something different?
Original comment by rum...@google.com
on 5 Feb 2013 at 3:45
I agree, this issue should be re-opened as the JsonReader isLenient() is
ignored.
The fromJson(JsonReader reader, Type typeOfT) method has this code:
boolean oldLenient = reader.isLenient();
reader.setLenient(true);
Gson is overriding the reader's leniency.
Original comment by craig.es...@gmail.com
on 18 Mar 2014 at 9:28
Original issue reported on code.google.com by
rum...@google.com
on 29 Jan 2013 at 10:45