Closed GoogleCodeExporter closed 9 years ago
By the way, the actual behaviour (how could I miss that...) is to return the
list [1, 2, 3, null], where the null is the obvious problem.
Original comment by martinpr...@google.com
on 8 Feb 2012 at 6:56
Gson is emulating the original implementation of org.json; it might be the
wrong choice but I'd prefer not to change it for backwards compatibility.
If you'd prefer for it to crash, use TypeAdapter rather than fromJson():
TypeAdapter<List<Integer>> typeAdapter = gson.getAdapter(new TypeToken<List<Integer>>() {});
List<Integer> list = typeAdapter.read("[1,2,3,]");
This will throw. The new TypeAdapter APIs are strict about ',' whereas
Gson.fromJson is lenient.
Original comment by limpbizkit
on 9 Feb 2012 at 12:59
Original issue reported on code.google.com by
martinpr...@google.com
on 8 Feb 2012 at 2:12