(bug 57214) use DispatchingEntitySerializer for JSON

This introduces DispatchingEntitySerializer, a serializer for entities
that dispatches to the appropriate serializer based on entity type. This
allows dumpJson to generate the appropriate JSON representation for all
types of entitites.

This incidentally also causes the datatype to be included in serialized
snaks in the output from dumpJson, fixing bug #57212
(but not #57213 and #57231).

bug: 57214
bug: 57212

Change-Id: Ic360a399c3abebecaae90c3186e385b0292663f9