Use ToJson instance method as RawSerializeFn if present
Test for custom serialization using ToJson instance method