Add polymorphic hooks to JSONSerializer