And my experience with the preceding now enables me to answer my original
question -- you debug serializer errors by attaching the Pivot source, set
exception breakpoints on the exceptions that are raised, and poke around on
the stack to get some idea of where in the input the deserialization fell
over.

Doing this, I discovered that JSONSerializer is intolerant of unknown
fields.  Other serializers I've used are perfectly happy to encounter a
field that isn't declared in the user object, and simply throw away the
corresponding value.  I think it would be great if Pivot did the same.  Yes,
I can declare all the fields that the server is known to return today, even
if I have no use for them, but I'll be in trouble if new fields (that the
implementors assume I can just ignore) get added later.

Anyway, I found at least two kinds of cryptic errors that occur when an
unknown field is encountered: SerializationException -- "Cannot convert
<some primitive json type> to null." (several places in the Pivot code), and
NullPointerException if the value is an array.

Reply via email to